Error:File:E:\matlab\work\Untitled4.m Line:39 Column:116 This statement is incomplete.%8_1.mnum0=[200];den0=conv([1,0],conv([0.1,1],[1,10])); [Gm1,Pm1,Wcg1,Wcp1]=margin(num0,den0);r=45;r0=Pm1;wa=50;w0=Wcp1;w=logspace(-2,3);[mag1,phase1]=bode(num0,den

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 02:24:45
Error:File:E:\matlab\work\Untitled4.mLine:39Column:116Thisstatementisincomplete.%8_1.mnum0=[200];den

Error:File:E:\matlab\work\Untitled4.m Line:39 Column:116 This statement is incomplete.%8_1.mnum0=[200];den0=conv([1,0],conv([0.1,1],[1,10])); [Gm1,Pm1,Wcg1,Wcp1]=margin(num0,den0);r=45;r0=Pm1;wa=50;w0=Wcp1;w=logspace(-2,3);[mag1,phase1]=bode(num0,den
Error:File:E:\matlab\work\Untitled4.m Line:39 Column:116 This statement is incomplete.
%8_1.m
num0=[200];
den0=conv([1,0],conv([0.1,1],[1,10]));
[Gm1,Pm1,Wcg1,Wcp1]=margin(num0,den0);
r=45;r0=Pm1;
wa=50;w0=Wcp1;
w=logspace(-2,3);
[mag1,phase1]=bode(num0,den0,w);
for epsilon=5:15
phic=(r-r0+epsilon)*pi/180;
alpha=(1+sin(phic))/(1-sin(phic));
[i1,ii]=min(abs(mag1-1/sqrt(alpha)));
wc=w(ii);
T=1/(wc*sqrt(alpha));
numc=[alpha*T,1];
denc=[T,1];
[num,den]=series(num0,den0,numc,denc);
[Gm,Pm,Wcg,Wcp]=margin(num,den);
if(Pm>=r);
if(Wcp>=wa);
break;end
end
printsys(numc,denc)
printsys(num,den)
[mag2,phase2]=bode(numc,denc,w);
[mag,phase]=bode(num,den,w);
subplot(2,1,1);
semilogx(w,20*log10(mag),w,20*log10(mag1),'--',w,20*log10(mag2),'-');
grid;
ylabel('幅值(dB)');
title('-- G0,-.Gc,-GOGc');
subplot(2,1,2);
semilogx(w,phase,w,phase1,'--',w,phase2,'-.',w,(w-180-w),':');
grid;
ylabel('相位(度)');
xlabel('频率(rad/sec)');
title(['校正后:幅值裕量=',num2str(20*log10(Gm)),'dB,','相位裕量=',num2str(Pm),'°','剪切频率=',num2str(Wcp),'s^1']);
disp(['校正前:幅值裕量=',num2str(20*log10(Gm1)),'dB,','相位裕量=',num2str(Pm1),'°','剪切频率=',num2str(Wcp),'s^1']);
disp(['校正后:幅值裕量=',num2str(20*log10(Gm)),'dB,','相位裕量=',num2str(Pm),'°','剪切频率=',num2str(Wcp),'s^1']);

Error:File:E:\matlab\work\Untitled4.m Line:39 Column:116 This statement is incomplete.%8_1.mnum0=[200];den0=conv([1,0],conv([0.1,1],[1,10])); [Gm1,Pm1,Wcg1,Wcp1]=margin(num0,den0);r=45;r0=Pm1;wa=50;w0=Wcp1;w=logspace(-2,3);[mag1,phase1]=bode(num0,den
最后一行少了 end
-------------------------------------------
num0=[200];
den0=conv([1,0],conv([0.1,1],[1,10]));
[Gm1,Pm1,Wcg1,Wcp1]=margin(num0,den0);
r=45;r0=Pm1;
wa=50;w0=Wcp1;
w=logspace(-2,3);
[mag1,phase1]=bode(num0,den0,w);
for epsilon=5:15
phic=(r-r0+epsilon)*pi/180;
alpha=(1+sin(phic))/(1-sin(phic));
[i1,ii]=min(abs(mag1-1/sqrt(alpha)));
wc=w(ii);
T=1/(wc*sqrt(alpha));
numc=[alpha*T,1];
denc=[T,1];
[num,den]=series(num0,den0,numc,denc);
[Gm,Pm,Wcg,Wcp]=margin(num,den);
if(Pm>=r);
if(Wcp>=wa);
break;
end
end
printsys(numc,denc)
printsys(num,den)
[mag2,phase2]=bode(numc,denc,w);
[mag,phase]=bode(num,den,w);
subplot(2,1,1);
semilogx(w,20*log10(mag),w,20*log10(mag1),'--',w,20*log10(mag2),'-');
grid;
ylabel('幅值(dB)');
title('-- G0,-.Gc,-GOGc');
subplot(2,1,2);
semilogx(w,phase,w,phase1,'--',w,phase2,'-.',w,(w-180-w),':');
grid;
ylabel('相位(度)');
xlabel('频率(rad/sec)');
title(['校正后:幅值裕量=',num2str(20*log10(Gm)),'dB,','相位裕量=',num2str(Pm),'°','剪切频率=',num2str(Wcp),'s^1']);
disp(['校正前:幅值裕量=',num2str(20*log10(Gm1)),'dB,','相位裕量=',num2str(Pm1),'°','剪切频率=',num2str(Wcp),'s^1']);
disp(['校正后:幅值裕量=',num2str(20*log10(Gm)),'dB,','相位裕量=',num2str(Pm),'°','剪切频率=',num2str(Wcp),'s^1']);
end % 少了一个这个
------------------------------
加上后运行未报错