MATLAB 实验六高层绘图

更新时间:2023-05-24 05:34:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

实验六 高层绘图操作

1. x=0:2*pi/101: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,'k:',x,y2,'b--',x,y3);

(2)

x=(0:pi/100:2*pi)';

y1=x.^2; y2=cos(2*x);

y3=y1.*y2;

subplot(3,1,1);

plot(x,y1);

title('y1');

subplot(3,1,2);

plot(x,y2);

title('y2');

subplot(3,1,3);

plot(x,y3);

title('y3');

(3)

x=(0:pi/100:2*pi)';

y1=x.^2;

y2=cos(2*x);

y3=y1.*y2;

subplot(3,4,1);bar(x,y1,'y');title('bar(x,y1,"y")'); subplot(3,4,2);stairs(x,y1,'m');title('stairs(x,y1,"m")'); subplot(3,4,3);stem(x,y1,'g');title('stem(x,y1,"g")'); subplot(3,4,4);fill(x,y1,'c');title('fill(x,y1,"c")'); subplot(3,4,5);bar(x,y2,'y');title('bar(x,y2,"y")'); subplot(3,4,6);stairs(x,y2,'m');title('stairs(x,y2,"m")'); subplot(3,4,7);stem(x,y2,'g');title('stem(x,y2,"g")'); subplot(3,4,8);fill(x,y2,'c');title('fill(x,y2,"c")'); subplot(3,4,9);bar(x,y3,'y');title('bar(x,y3,"y")');

subplot(3,4,10);stairs(x,y3,'m');title('stairs(x,y3,"m")'); subplot(3,4,11);stem(x,y3,'g');title('stem(x,y3,"g")');

subplot(3,4,12);fill(x,y3,'c');title('fill(x,y3,"c")');

3. x=-5:0.1:5;

if x<=0

y=(x+sqrt(pi))./(exp(2));

else y=1/2*(log(x+sqrt(1+x.^2))); end

y

plot(x,y)

4. a=input('a=');

b=input('b=');

n=input('n=');

theta=0:0.01:2*pi;

rho=a*sin(b+n*theta);

polar(theta,rho,'k')

a=1

b=1

n=1

5. x=-5:0.5:5;

y=0:1/3:10;

[x,y]=meshgrid(x,y);

z=cos(x).*cos(y).*exp(-(sqrt(x.^2+y.^2)/4)); subplot(2,2,1);

surf(x,y,z);

subplot(2,2,2);

contour3(x,y,z);

6. s=0:0.05:pi/2; t=0:0.05:3*pi/2;

[s,t]=meshgrid(s,t);

[x,y,z]=peaks(30); x=cos(s).*cos(t); y=cos(s).*sin(t); z=sin(s);

surf(x,y,z);shading flat;

本文来源:https://www.bwwdw.com/article/hs24.html

Top