《控制系统的MATLAB仿真和设计课后答案.docx》由会员分享,可在线阅读,更多相关《控制系统的MATLAB仿真和设计课后答案.docx(9页珍藏版)》请在第壹文秘上搜索。
1、第二章lx=15223394857760x(6)x(l35)x(4:end)x(find(x70)2T=1-23-42-3;n=length(T);TT=T,;fork=n-l:-1:0B(:,n-k)=TT.k;endBtest=vander(T)3A=zeros(2,5);A(:)=-4:5L=abs(八)3islogical(L)X=A(L)4A=4,15,-45,10,6;56,0,17,-45,0find(A=10&Apl=conv(l,0,2,conv(l,4,1,1);p2=l011;q,r=deconv(pl,p2);cq=商多项式为;Cr=余多项式为;disp(cq,poly
2、2str(q,s,),disp(cr,poly2str(r,s,)6A=111213;141516;171819;PA=poly(八)PPA=poly2str(PA,s,)第三章ln=(-10:10),;y=abs(n);plot(n,y,r.,MarkerSize,20)axisequalgridonxlabel(,n)2x=0:pi/100:2*pi; y=2*exp(-0.5*x).*sin(2*pi*x); plot(x,y),gridon;3t=0:pi/50:2*pi; x=8*cos(t); y=4*sqrt(2)*sin(t); z=-4*sqrt(2)*sin(t); plo
3、t3(x,y,z,p,); title(,Linein3-DSpace,); text(0,0,0,origin,); xlabel(,X),yTable(,Y,),zlable(,Z,);grid;4theta=0:0.Ol:2*pi; rho=sin(2*theta).*cos(2*theta); polar(theta,rho,k,);5x,y,z=sphere(20);zl=z;zl(:,1:4)=NaN; cl=ones(size(zl); surf(3*x,3*y,3*zl,cl);holdon z2=z; c2=2*ones(size(z2);c2(:,1:4)=3*ones(s
4、ize(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);gridonholdoff第四章lform=100:999ml=fix(m100);m2=rem(fix(m10),10);m3=rem(m,10);ifm=m1*m1*m1+m2*m2*m2+m3*m3*m3disp(m)endend2M文件:functions,p=fcircle(r)s=pi*r*r;p=2*pi*r;主程序:s,p=fcircle(10)3y=0;n=100;fori=l:ny=y+lii;endy4M文件:function
5、f=factor(n)ifns=0;fori=l:5s=s+factor(i);ends5sum=0;i=l;whilesumn=i-26for循环M文件:functionk=jcsum(n)k=0;fori=0:nk=k+2i;end主程序:jcsum(63)WhiIe循环M文件:functionk=jcsuml(n)k=0;i=0;whileiA=2,1,-5,1;1,-5,0,7;0,2,1,-1;1,6,-1,-4;b=13,-9,6,OY;x=Ab2M文件:functionf=fxyz(u)x=u(l);y=u(2);z=u(3);f=x+y.2.x4+z.2.y2.z;主程序:U,
6、fmin=fminsearchCfxyz,O.5,O.5,O.5)3X=1inspace(O,2*pi,50);Y=sin(X);P=polyfit(X,Y,3)AX=1inspace(0,2*pi,50);Y=sin(X);Yl=polyval(P,X)plot(X,Y:o,x,yi,-*)4x=0:2.5:10;h=030r601,;T=95,14,0,0,0;88,48,32,12,6;67,64,54,48,41;xi=0:0.5:10;hi=0:10:60;temps=interp2(x,h,T,xi,hi,cubic,); mesh(xi,hi,temps);第六章lsymsxy=
7、finverse(ltan(x)2symsxy f=l(l+x2);g=sin(y);fg=compose(f,g)3symsx g=(exp(x)+x*sin(x)(1/2);dg=diff(g)4F=int(int(,x*exp(-*y),),y,)5symsx F=ztrans(x*exp(-*10)6a=0l;-2-3;symssinv(s*eye(2)-a);7f=solve(,a*x2b*x+c,)8f=solve(,x+y+z=l,-y+z=2,2*-y-z=l,)9y=dsolve(,D2y+2*Dy+2*y=0,y(0)=l,Dy(O)=O,)ezplot(y),gridon
8、10a=maple(,simplify(sin(x)2+cos(x)2);)llf=maple(,Iaplace(exp(-3*t)*sin(t),t,s);,)12symstxF=sin(x*t+2*t);L=laplace(F)第七章34567第八章l-lh=tf(5,0,1,2,2)l-2s=tf(s);H=5(s2+2*s+2);H.inputdelay=2l-3h=tf(0.5,0,l,-0.5,0.5,0.1)2num=2*l,0.5;den=l,0.2,1.01;sys=tf(num,den)z,p,k=tf2zp(num,den);zpk(z,p,k)A,B,C,D=tf2ss
9、(num,den);ss(A,B,C,D)3num=l,5;den=l,6,5,1;ts=O.1;sysc=tf(num,den);sysd=c2d(sysc,ts,tusti11,)4 rl=l;r2=2;cl=3;c2=4;A,B,C,D=linmod(,x84,); num,den=ss2tf(A,B,C,D);sys=tf(num,den)5A=1,l,0;0,l,0;0,O,2;B=0,O;1,0;0,-2;n=size(八) Tc=ctrb(A,B);ifn=rank(Tc)disp(系统完全能控);elsedisp(系统不完全能控);end第九章lnum=2,5,1;den=l,
10、2,3; bode(num,den);gridon;figure; nyquist(num,den);2num=5*l,5,6;den=l,6,10,8; step(num,den);gridon;figure; impulse(num,den);gridon;3kosi=0.7;wn=6; num=wn2;den=1,2*kosi*wn,Wne2; step(num,den);gridon;figure; impulse(num,den);gridon;4M文件:functionrtab,info=routh(den)info=;vecl=den(l:2:length(den);nrT=le
11、ngth(vecl);vec2=den(2:2:length(den)-1);rtab=vecl;vec2,zeros(1,nrT-length(vec2);fork=l:length(den)-2,alpha(k)=vecl(I)vec2(l);fori=l:length(vec2),a3(i)=rtab(k,i+l)-alpha(k)*rtab(k+l,i+l);endifsum(abs(a3)=0a3=polyder(vec2);info=info,Allelementsinrow,.int2str(k+2)arezeros/;elseifabs(a3(l)den=l,2,8,12,20
12、,16,16;rtab,info=routh(den)a=rtab(:,1)ifall(a0)disp(系统是稳定的);elsedisp(系统是不稳定的);end5num=7*l,5;den=conv(l,0,0,conv(l,10,1,1);gm,pm,wg,wc=margin(num,den)第十章1 M文件:functionvarargout=rg_lead(ng,dg,si)ifnargout=lngv=polyval(ng,si);dgv=polyval(dg,si);g=11gvdgv;thetal=pi-angle(g);zc=real(sl)-imag(sl)/tan(thetal);t=-lzc;varargoutl=t,1;elseifnargout=2ngv=poIyval(ng,si);dgv=poIyval(dg,si);g=ngvdgv;theta=angle(g);phi=angle(sl);ifthetaOphi-c=pi-theta;endifthetaO;phi-c=theta