文档详情

MATLAB程序设计与应用刘卫国(第二版)实验六答案.doc

发布:2015-09-05约2.16千字共3页下载文档
文本预览下载声明
实验六 高层绘图操作 一、设 已知,完成下列操作: (1)在同一坐标系下用不同的颜色和线型绘制三条曲线。 (2)以子图形式绘制三条曲线。 (3)分别用条形图、阶梯图、杆图和填充图绘制三条曲线。 三、已知 在区间绘制函数曲线。 绘制极坐标曲线,并分析参数对曲线形状的影响。 绘制函数的曲面图和等高线。 其中的21个值均匀分布在[-5,5]范围,的31个值均匀分布在[0,10],要求使用s ubplot(2,1,1)和subplot(2,1,2)将生产的曲面图和等高线图画在同一窗口上。 答案: 1. x=0:pi/100:2*pi; y=(0.5+3*sin(x)/(1+x.^2))*cos(x); plot(x,y) 2.(1) y1=x.^2; y2=cos(2*x); y3=y1.*y2; plot(x,y1,b-,x,y2,r:,x,y3,y--); (2)1,y1=x.^2; plot(x,y1); 2,y2=cos(2*x); plot(x,y2); 3,y1=x.^2; Y2=cos(2*x); y3=y1.*y2; plot(x,y3); (3)1, x=0:0.5:6; y1=x.^2; subplot(2,2,1);bar(x,y1,b) title(bar(x,y,b));axis([0,6,0,40]) subplot(2,2,2);stairs(x,y1,r) title(stairs(x,y,r));axis([0,6,0,40]) subplot(2,2,3);stem(x,y1,g) title(stem(x,y,g));axis([0,6,0,40]) subplot(2,2,4);fill(x,y1,y) title(fill(x,y,y));axis([0,6,0,40]) 2. x=0:2*pi/100:2*pi; y2=cos(2*x); subplot(2,2,1);bar(x,y2,b) title(bar(x,y,b));axis([0,2*pi,0,1]) subplot(2,2,2);stairs(x,y2,r) title(stairs(x,y,r));axis([0,2*pi,0,1]) subplot(2,2,3);stem(x,y2,g) title(stem(x,y,g));axis([0,2*pi,0,1]) subplot(2,2,4);fill(x,y2,y) title(fill(x,y,y));axis([0,2*pi,0,1]) 3. x=0:0.05:6; y1=x.^2; y2=cos(2*x); y3=y1.*y2; subplot(2,2,1);bar(x,y3,b) title(bar(x,y,b));axis([0,6,0,1]) subplot(2,2,2);stairs(x,y3,r) title(stairs(x,y,r));axis([0,6,0,1]) subplot(2,2,3);stem(x,y3,g) title(stem(x,y,g));axis([0,6,0,1]) subplot(2,2,4);fill(x,y3,y) title(fill(x,y,y));axis([0,6,0,1]) 3. x=-5:0.1:5; if x=0 y=(x+pi.^0.5)/exp(2); else y=0.5*log(x+(1+x.^2).^0.5); end plot(x,y) 4. a=input(please input a:) b=input(please input b:) n=input(please input n:) theta=0:0.05:2*pi; rho=a.*sin(b+n.*theta); polar(theta,rho,g) 5. x=-5:0.5:5; y=0:0.3:10; [x,y]=meshgrid(x); z=cos(x).*cos(y).*exp(-0.25.*(x.^2+y.^2).^0.5); subplot(2,1,1) xlabel(x-axis),ylabel(y-axis),zlabel(z-axis) plot3(x,y,z,b) title(surf) subplot(2,1,2) xlabel(x-axis),ylabel(y-axis),
显示全部
相似文档