文档详情

自控控制理论实验.doc

发布:2017-04-04约1.95千字共21页下载文档
文本预览下载声明
Using Toolbox Path Cache. Type help toolbox_path_cache for more info. To get started, select MATLAB Help from the Help menu. 基本二维绘图 1)向量绘图 x=0:2*pi/100:2*pi; y1=sin(2*x);y2=cos(2*x); plot(x,y1) plot(x,y2) plot(x,y1,x,y2) 保持作图 plot(x,y1);hold on; plot(x,y2);hold off; 矩阵作图 plot(x,[y1 y2]) 设定颜色与线形 plot(x,y1,c:,x,y2,ro) 多窗口绘图 figure(1);plot(x,y1); figure(2);plot(x,y2); 子图绘图 subplot(221);plot(x,y1); subplot(222);plot(x,y2); subplot(223);plot(x,y1,x,y1+y2); subplot(224);plot(x,y2,x,y1-y2); 复变函数绘图 w=0.01:0.01:10; G=1./(1+2*w*i); subplot(121);plot(G); subplot(122);plot(real(G),imag(G)); 插值绘图 x=0:2*pi/8:2*pi;y=sin(x); plot(x,y,o);hold on; xi=0:2*pi/100:2*pi; yi=spline(x,y,xi); plot(xi,yi,m); 反白绘图与绘图背景色设定 whitebg whitebg(b) whitebg(k) 2)函数绘图 fplot(sin,[0 4*pi]) f=sin(x);fplot(f,[0 4*pi]) fplot(sin(1/x),[0.01 0.1],1e-3) fplot([tan(x),sin(x),cos(x)],[-2*pi,2*pi,-2*pi,2*pi]) 3)符号函数快捷绘图 syms x f=exp(-0.5*x)*sin(x); ezplot(f,[0,10]) (2)多种二维绘图 1)半对数绘图 w=logspace(-1,1); g=20*log10(1./(1+2*w*i)); p=angle(1./(1+2*w*i))*180/pi; subplot(211);semilogx(w,g);grid; Warning: Imaginary parts of complex X and/or Y arguments ignored. subplot(212);semilogx(w,p);grid; 2)极坐标绘图 t=0:2*pi/180:2*pi; mo=cos(2*t); polar(t,mo); 3)直方图 t=0:2*pi/8:2*pi; y=sin(t); bar(t,y) 4)离散棒图 t=0:2*pi/8:2*pi; y=sin(t); stem(t,y) 5)阶梯图 t=0:2*pi/8:2*pi; y=sin(t); stairs(t,y) 6)彗星绘图 t=-pi:pi/200:pi; comet(t,tan(sin(t))-sin(tan(t))); (3)图形注释 y1=dsolve(D2u+2*Du+10*u=0,Du(0)=1,u(0)=0,x); y2=dsolve(D2u+2*Du+10*u=1,Du(0)=0,u(0)=0,x); ezplot(y1,[0,5]);hold on;ezplot(y2,[0,5]); axis([0,5,-0.1,0.2]) title(二阶系统时间响应); xlabel(时间t);ylabel(响应幅值y); gtext(零输入响应); gtext(零状态响应); grid;hold off;
显示全部
相似文档