??? 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(num... %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']);
展开
 我来答
书宬
推荐于2016-06-21 · TA获得超过7851个赞
知道大有可为答主
回答量:2125
采纳率:75%
帮助的人:3321万
展开全部
最后一行少了 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 % 少了一个这个
------------------------------
加上后运行未报错
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式