⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex3_10.m

📁 华东理工大学自动化系《控制系统分析、设计和应用》教材配套程序实例,有关说明: 1. 安装MATLAB软件。安装时
💻 M
字号:
% ex3_10
% 根据系统的阶跃响应,计算时域性能指标
width=300;
hight=250;
figure('pos',[20,30,width,hight],'color','w')
load stepdata;
tend=tt(length(tt));
tsp=tt(2)-tt(1);
[mp,ind1]=max(yy);
yss=mean(yy(round(tend*0.9):tend));
pos=(mp-yss)*100/yss;
tp=ind1;
[minp,ind2]=min(yy(ind1+1:tend));
[mp1,ind3]=max(yy(ind1+ind2+1:tend));
Rs=(mp-yss)/(mp1-yss);
TP=ind2+ind3;
TP1=TP+ind1;
inda=find(yy(1:ind1)>0.95*yss & yy(1:ind1)<1.05*yss);
a=inda(max(find(yy(inda)<yss)));
b=inda(min(find(yy(inda)>yss)));
tr=a+(b-a)*(yss-yy(a))/(yy(b)-yy(a))-1
tss=0.05;%0.02或0.05
i=length(tt);
n=0;
while n==0,
    i=i-1;
    if (i==1| yy(i)>=(1+tss)*yss),
        n=1;
    end;
end;
t1=i;
i=length(tt);
n=0;
while n==0,
    i=i-1;
    if (i==1 | yy(i)<=(1-tss)*yss),
        n=1;break;
    end;
end;
t2=i;
if t2>t1,
    ts=t2;
else 
    ts=t1;
end;
axes('pos',[0.1 0.15 0.8 0.72]);
plot(yy);
grid; 
ra=round((mp+0.1*yss)*10)/10;
axis([0 tend 0 ra]);
xlabel(['×',num2str(tsp)]);
line([tr tr],[0 yss],'lines','--');
line([tp tp],[0 yss],'lines','--');
line([TP1 TP1],[0 yss],'lines','--');
line([0 tend],[yss yss],'lines','--');
line([ts ts],[(1+tss)*yss 0],'lines','--');
line([ts-0.02*tend ts+tend*0.2],[(1+tss)*yss (1+tss)*yss],'lines','--');
line([ts-0.02*tend ts+tend*0.2],[(1-tss)*yss (1-tss)*yss],'lines','--');
line([tp TP1],[0.45*yss 0.45*yss]); 
line([TP1 TP1-tend*0.02],[0.45*yss 0.42*yss]);
line([tp tp+tend*0.02],[0.45*yss 0.48*yss]); 
line([tp tp+tend*0.02],[0.45*yss 0.42*yss]);
line([TP1 TP1-tend*0.02],[0.45*yss 0.48*yss]); 
text((tp+TP)/2-width*0.02,0.52*yss,'TP');
line([tr 0],[0.45*yss 0.45*yss]);
line([tr tr-tend*0.02],[0.45*yss 0.48*yss]);
line([tr tr-tend*0.02],[0.45*yss 0.42*yss]);
line([0 tend*0.02],[0.45*yss 0.48*yss]);
line([0 tend*0.02],[0.45*yss 0.42*yss]);
text(tr/2-width*0.02,0.52*yss,'TR');
line([tp tp],[yss mp]);
line([tp tp+tend*0.008],[yss 1.1*yss]);
line([tp tp-tend*0.008],[yss 1.1*yss]);
line([tp tp+tend*0.008],[mp mp-0.1*yss]);
line([tp tp-tend*0.008],[mp mp-0.1*yss]);
text(tp*1.3,mp-0.05*yss,['B1=',num2str(mp)]);
line([TP1 TP1],[yss mp1]);
line([TP1 TP1+tend*0.005],[yss 1.05*yss]);
line([TP1 TP1-tend*0.005],[yss 1.05*yss]);
line([TP1 TP1+tend*0.005],[mp1 mp1-0.05*yss]);
line([TP1 TP1-tend*0.005],[mp1 mp1-0.05*yss]);
text(TP1,mp1+0.05*yss,['B2=',num2str(mp1)]);
line([0 ts],[0.25*yss 0.25*yss]);
line([0 tend*0.02],[0.25*yss 0.28*yss]);
line([0 tend*0.02],[0.25*yss 0.22*yss]);
line([ts ts-tend*0.02],[0.25*yss 0.28*yss]);
line([ts ts-tend*0.02],[0.25*yss 0.22*yss]);
text(ts/2-width*0.02,0.32*yss,'TS');
te=tend*.9;line([te te],[yss 0]);
line([te te+tend*0.005],[0 0.05*yss]);
line([te te-tend*0.005],[0 0.05*yss]);
line([te te+tend*0.005],[yss (1-0.05)*yss]);
line([te te-tend*0.005],[yss (1-0.05)*yss]);
text(te-width*0.02,0.4*yss,'Yss','rot',90);
text(tend*0.7,0.71*ra,['Yss=',num2str(yss)]);
text(tend*0.7,0.79*ra,['TS=',num2str(ts*tsp)]);
text(tend*0.7,0.87*ra,['TP=',num2str(TP*tsp)]);
text(tend*0.5,0.37*ra,['TR=',num2str(tr*tsp)]);
text(tend*0.7,0.95*ra,['RS=',num2str((mp-yss)/(mp1-yss))]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -