过程控制2-6
我的实现:
-
使用作图法:先根据算出的阶跃响应数值,一阶线性插值拟合,然后计算斜率,得到拐点(120,7.4),斜率约0.092。推得 τ = 39.28 , T = 217.676 τ=39.28,T=217.676 τ=39.28,T=217.676 。图片粘贴上去有点失真。
-
使用计算法
还是先一阶线性插值,然后计算h=0.63,0.39时t的数值,根据
T = 2 ∗ ( t 2 − t 1 ) T = 2*(t2-t1) %计算时间常数 T=2∗(t2−t1)
τ = 2 ∗ t 1 − t 2 τ = 2*t1 -t2 %计算延迟时间 τ=2∗t1−t2
计算时间常数、延迟时间:
T = 96.1 T = 96.1 %计算时间常数 T=96.1
τ = 68.15 τ = 68.15 %计算延迟时间 τ=68.15 -
对比综合:
对计算得到的数值在SIMULINK里面进行仿真,在外部.m文件调用,得到如下两图,上面的是计算法得到的,下面的是作图法得到的。相对而言,作图法效果更好。
% 作业2-6
% @Author:轩笑鹄
% @Date: 2021年4月6日19:15
% 参考链接:https://ww2.mathworks.cn/matlabcentral/answers/349598-error-using-griddedinterpolant-the-grid-vectors-must-contain-unique-points
tw = 10;% 输出无变化的时间
t =[10 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400]-tw;
h1 =[0.00 0.20 0.80 2.00 3.60 5.40 7.40 9.30 11.00 12.60 13.60 14.40 15.10 15.75 16.35 16.85 17.25 17.55 17.75 17.90 18.00];
hh = h1/h1(length(h1)); %转换成无量纲形式
% 绘制单位阶跃响应曲线
plot(t,hh,'r-');
h1 = 0.39; t1 = interp1(hh,t,h1)+tw %一维线性插值计算hh=0.39时的时间t1
h2 = 0.63; t2 = interp1(hh,t,h2)+tw %一维线性插值计算hh=0.63时的时间t2
T = 2*(t2-t1) %计算时间常数
tao = 2*t1 -t2 %计算延迟时间
t =[0 10 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400];
h1 =[0 0.00 0.20 0.80 2.00 3.60 5.40 7.40 9.30 11.00 12.60 13.60 14.40 15.10 15.75 16.35 16.85 17.25 17.55 17.75 17.90 18.00];
simOut = sim('exp2_6_mod.mdl',400)
figure(2)
plot(t,h1,'r-',simOut.tout,simOut.yout{1}.Values.data,'b--');
legend('原系统','近似系统');
POINT = 500;
tt =linspace(0,400,POINT);
h2 = interp1(t,h1,tt) ;
figure(3)
t_dif = tt(2:POINT);
h_dif = diff(h2);
plot(tt,h2,'g-');
hold on
y = 0.092*(tt-120)+7.4;
plot(tt,y,'b-');
hold on
xx = linspace(0,400,POINT);
yy= linspace(20,20,POINT);
plot(xx,yy,'r-')
axis([0 400 0 20])
simOut = sim('exp2_6_mod2.mdl',400)
figure(4)
plot(t,h1,'r-',simOut.tout,simOut.yout{1}.Values.data,'b--');
legend('原系统','近似系统');