?? dmystep.m
字號:
if dfadeback==2
dmystepbb
else
%for i=1:n
% if db(i)==0
% db(i);
% else
% figure(i+1)
% dstep(da,db,dc,dd,i);
% end
%end
dwindstep=figure('color',[0.8,0.7,0.8],'position',[0.1*winw,0.1*winh,0.8*winw,0.8*winh],...
'name','離散系統輸出Y(z)和階躍響應','numbertitle','off','menubar','figure',...
'resize','off');
drr1=size(dfbnum);
drr2=size(dfbden);
dfinderr=0;
%判斷是否為比例環節
if ((drr1(1,2)==1)&(drr2(1,2)==1)),
dfinderr=1;
dsysb=tf(dfbnum,dfbden,dhT);
ddcg=dcgain(dsysb);
subplot(1,1,1);
step(dsysb);
grid on;hold on
strtext=['這是比例環節,系統指標: 穩態值=' num2str(ddcg) ' ; tr,tp,Mp,ts 無意義 '];
title(strtext);
else,
n=length(da);
for i=1:n
de(i,i)=1;
end
dsysb=dss(da,db,dc,dd,de,dhT);
ddpb=pole(dsysb);
dii=find(abs(ddpb)>=1);dn1=length(dii);
if (dn1>0)
ddcg=dcgain(dsysb);
[dyc dx]=step(dsysb);
dnsn=length(dyc);dt=1:dnsn;
dyc1=dyc/ddcg;
subplot(2,1,1);
plot(dt,dx,'r');
grid on;hold on
xlabel('s/t');
ylabel('X(z)');
legend('紅線:X(z)狀態曲線',0);
title('X(z)狀態曲線');
subplot(2,1,2);
grid on;hold on
step(dsysb);
% plot(t,yc1,'r',t,yc,'b');
grid on;hold on
xlabel('k*T');
ylabel('Y(z)和Y(z)/dcg');
%legend('紅線:Y(z)/dcg階躍響應曲線','藍線:Y(z)階躍響應曲線',0);
strtext=[' 不穩定系統,無穩態值且tr,tp,Mp,ts 無意義 '];
title(strtext);
else
ddcg=dcgain(dsysb);
[dyc dty dx]=step(dsysb);
dnsn=length(dyc);dt=1:dnsn;
dyc1=dyc/ddcg;
subplot(2,1,1);
plot(dt,dx,'r');
grid on;hold on
xlabel('s/t');
ylabel('X(z)');
legend('紅線:X(z)狀態曲線',0);
title('X(z)狀態曲線');
subplot(2,1,2);
grid on;hold on
step(dsysb);
% plot(t,yc1,'r',t,yc,'b');
grid on;hold on
xlabel('k*T');
ylabel('Y(z)和Y(z)/dcg');
dycn=step(dsysb);
dtn=length(dycn);
[dycnn dty]=step(dsysb);dcin=length(dycnn);
%[dz,dp]=ss2zp(dsysb);
dp=pole(dsysb);
uicontrol(dwindstep,'style','push','string','穩態值',...
'position',[0.06,0.01,0.11,0.05],'units','normalized',...
'callback','dmysteppre_dcg');
uicontrol(dwindstep,'style','push','string','上升時間tr',...
'position',[0.22,0.01,0.11,0.05],'units','normalized',...
'callback','dmysteppre_tr');
uicontrol(dwindstep,'style','push','string','峰值時間tp和最大超調量Mp',...
'position',[0.37,0.01,0.25,0.05],'units','normalized',...
'callback','dmysteppre_tpmp');
uicontrol(dwindstep,'style','push','string','調整時間ts',...
'position',[0.66,0.01,0.11,0.05],'units','normalized',...
'callback','dmysteppre_ts');
uicontrol(dwindstep,'style','push','string','結束',...
'position',[0.83,0.01,0.11,0.05],'units','normalized',...
'callback','dclosestep');
end
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -