《计算机仿真课后答案.pdf》由会员分享,可在线阅读,更多相关《计算机仿真课后答案.pdf(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、第二章x=15 22 33 94 85 77 60 x(6)x(1 3 5)x(4:end)x(find(x70)T=1-2 3-4 2-3;n=length(T);TT=T;for k=n-1:-1:0B(:,n-k)=TT.k;endBtest=vander(T)A=zeros(2,5);A(:)=-4:5L=abs(A)3islogical(L)X=A(L)A=4,15,-45,10,6;56,0,17,-45,0find(A=10&A=20)p1=conv(1,0,2,conv(1,4,1,1);p2=1 0 1 1;q,r=deconv(p1,p2);cq=商多项式为;cr=余多项式
2、为;disp(cq,poly2str(q,s),disp(cr,poly2str(r,s)A=11 12 13;14 15 16;17 18 19;PA=poly(A)PPA=poly2str(PA,s)第三章页脚下载后可删除,如有侵权请告知删除!n=(-10:10);y=abs(n);plot(n,y,r.,MarkerSize,20)axis equalgrid onxlabel(n)x=0:pi/100:2*pi;y=2*exp(-0.5*x).*sin(2*pi*x);plot(x,y),grid on;t=0:pi/50:2*pi;x=8*cos(t);y=4*sqrt(2)*sin
3、(t);z=-4*sqrt(2)*sin(t);plot3(x,y,z,p);title(Line in 3-D Space);text(0,0,0,origin);xlabel(X),ylable(Y),zlable(Z);grid;theta=0:0.01:2*pi;rho=sin(2*theta).*cos(2*theta);polar(theta,rho,k);x,y,z=sphere(20);z1=z;z1(:,1:4)=NaN;c1=ones(size(z1);surf(3*x,3*y,3*z1,c1);hold onz2=z;c2=2*ones(size(z2);c2(:,1:4
4、)=3*ones(size(c2(:,1:4);surf(1.5*x,1.5*y,1.5*z2,c2);colormap(0,1,0;0.5,0,0;1,0,0);grid onhold off页脚下载后可删除,如有侵权请告知删除!第四章for m=100:999m1=fix(m/100);m2=rem(fix(m/10),10);m3=rem(m,10);if m=m1*m1*m1+m2*m2*m2+m3*m3*m3disp(m)endendfunctions,p=fcircle(r)s=pi*r*r;p=2*pi*r;y=0;n=100;for i=1:ny=y+1/i/i;endys=0
5、;for i=1:5s=s+factor(i);endssum=0;i=1;while sum2000sum=sum+i;i=i+1;end;n=i-2function k=jcsum(n)k=0;for i=0:nk=k+2i;end页脚下载后可删除,如有侵权请告知删除!或function k=jcsum1(n)k=0;i=0;while i0)disp(系统是稳定的);elsedisp(系统是不稳定的);endnum=7*1,5;den=conv(1,0,0,conv(1,10,1,1);gm,pm,wg,wc=margin(num,den)第十章ng0=1;dg0=10000*1 0-1
6、.1772;g0=tf(ng0,dg0);%满足开环增益的为校正系统的传递函数s=kw2s(0.7,0.5)%期望的闭环主导极点ngc=rg_lead(ng0,dg0,s);gc=tf(ngc,1)g0c=tf(g0*gc);rlocus(g0,g0c);b1=feedback(g0,1);%未校正系统的闭环传递函数b2=feedback(g0c,1);%校正后系统的闭环传递函数figure,step(b1,r-,b2,b);grid on%绘制校正前后系统的单位阶跃响应曲线KK=20;s1=-2+i*sqrt(6);a=1ng0=10;dg0=conv(1,0,1,4);g0=tf(ng0,
7、dg0);ngc,dgc,k=rg_lag(ng0,dg0,KK,s1,a);gc=tf(ngc,dgc)g0c=tf(KK*g0*gc);页脚下载后可删除,如有侵权请告知删除!b1=feedback(k*g0,1);b2=feedback(g0c,1);step(b1,r-,b2,b);grid onKK=128;s1=-2+i*2*sqrt(3);a=2ng0=10;dg0=conv(1,0,conv(1,2,1,8);g0=tf(ng0,dg0);ngc,dgc,k=rg_lag(ng0,dg0,KK,s1,a);gc=tf(ngc,dgc)g0c=tf(KK*g0*gc);rlocus
8、(g0,g0c);b1=feedback(k*g0,1);b2=feedback(g0c,1);figure,step(b1,r-,b2,b);grid onng0=1;dg0=conv(1,0,0,1,5);g0=tf(ng0,dg0);w=logspace(-3,3);KK=1;Pm=50;ngc,dgc=lead4(ng0,dg0,KK,Pm,w);gc=tf(ngc,dgc);g0c=tf(KK*g0*gc);bode(KK*g0,w);hold on,bode(g0c,w);grid on,hold offgm,pm,wcg,wcp=margin(g0c)Kg=20*log10(gm
9、)g1=feedback(g0c,1);bode(g1),grid on,mag,phase,w=bode(g1);a=find(mag=0.707*mag(1);wb=w(a(1)max(mag)b=find(mag=max(mag)wr=w(b)KK=40;Pm=50;ng0=KK*1;dg0=conv(1,0,conv(1,1,1,4);g0=tf(ng0,dg0);w=logspace(-2,4);ngc,dgc=fg_lead_pm(ng0,dg0,Pm,w)gc=tf(ngc,dgc),g0c=tf(g0*gc);页脚下载后可删除,如有侵权请告知删除!b1=feedback(g0,
10、1);b2=feedback(g0c,1);step(b1,r-,b2,b);grid onfigure,bode(g0,r-,g0c,b,w),grid on,gm,pm,wcg,wcp=margin(g0c),Km=20*log10(gm)KK=200;bp=0.3;ts=0.7;delta=0.05;ng0=1;dg0=conv(1,0,conv(0.1,1,conv(0.02 1,conv(0.01,1,0.005 1);g0=tf(ng0,dg0);w=logspace(-4,3);t=0:0.1:3;mag,phase=bode(KK*g0,w);%2、确定期望的开环传递函数mr=
11、0.6+2.5*bp;wc=ceil(2+1.5*(mr-1)+2.5*(mr-1)2)*pi/ts),h=(mr+1)/(mr-1)w1=2*wc/(h+1),w2=h*w1w1=wc/10;w2=25;ng1=1/w1,1;dg1=conv(1/w2,1,conv(1,0,1,0);g1=tf(ng1,dg1);g=polyval(ng1,j*wc)/polyval(dg1,j*wc);K=abs(1/g);%剪切频率处幅值为 1,求 K 值g1=tf(K*g1)%3、确定反应环节传递函数h=tf(dg1,ng1);Kh=1/K;h=tf(Kh*h)%期望频率特性的倒特性%4、验算性能指标g2=feedback(KK*g0,h);%校正后,系统的开环传递函数b1=feedback(KK*g0,1);b2=feedback(g2,1);bode(KK*g0,r-,g2,b,h,g,w);grid onfigure,step(b1,r-,b2,b,t);grid on,pos,tr,ts,tp=stepchar(b2,delta)【本文档内容可以自由复制内容或自由编辑修改内容期待你的好评和关注,我们将会做得更好】页脚下载后可删除,如有侵权请告知删除!
限制150内