1 MATLAB 绘图有什么技巧

  • 3420
请先 登录 后评论

1 个回答

侯玉林 - 研究生

举几个实例,不知能否满足你的要求:

 syms xt
ezplot('t*cos(t)','t*sin(t)',[0,4*pi])

attachments-2018-07-Qhw7R3Ai5b605ea4359db.jpg

t=0:pi/20:2*pi;
y=exp(sin(t));
plotyy(t,y,t,y,'plot','stem')

attachments-2018-07-L05MmuPa5b605eaf6bccc.jpg

t=0:pi/50:15*pi;
plot3(sin(t),cos(t),t,'r*')
v=axis
text(0,0,0,'Origin')

attachments-2018-07-QUgMlVuU5b605eba076c7.jpg

[x,y]=meshgrid([-2:0.1:2]);
z=x.*exp(-x.^2-y.^2);
subplot(1,2,1)
plot3(x,y,z)
subplot(1,2,2)
surf(x,y,z)

attachments-2018-07-sBanm5Af5b605ec5d9f7f.jpg

[x,y,z]=peaks(30);
pcolor(x,y,z);
shading interp
hold on
Contour(x,y,z,20,'k')
colorbar('horiz')
c=Contour(x,y,z,8);
clabel(c)

attachments-2018-07-8qq6Xege5b605ed20ab98.jpg

x=0:0.1:10;
y=sin(x);
fill([x,10],[y,0],'r')

attachments-2018-07-RdKPGguB5b605edc7fae1.jpg

x=0:0.01*pi:pi*16;
j=sqrt(-1);
subplot(2,2,1);
plot(abs(sin(x)).*(cos(x)+j*sin(x)),'LineWidth',3);
xlim([-1 1]);ylim([-1,1]);
subplot(2,2,2);
plot(abs(sin(x/2)).*(cos(x)+j*sin(x)),'LineWidth',3);
xlim([-1 1]);ylim([-1,1]);
subplot(2,2,3);
plot(abs(sin(x/3)).*(cos(x)+j*sin(x)),'LineWidth',3);
xlim([-1 1]);ylim([-1,1]);
subplot(2,2,4);
plot(abs(sin(x/4)).*(cos(x)+j*sin(x)),'LineWidth',3);
xlim([-1 1]);ylim([-1 1]);

attachments-2018-07-4d8xuHI95b605ee795d3c.jpg

[x,y,z]=peaks(25);
figure
surf(x,y,z)
mesh(x,y,z)

attachments-2018-07-uTMc733w5b605ef470e1c.jpg

X=-10:0.1:10;
Y=-10:0.1:10;
[X,Y]=meshgrid(X,Y);
Z=-X.^2-Y.^2+200;
mesh(X,Y,Z)

attachments-2018-07-lSS9wDBQ5b605f01520f7.jpg

请先 登录 后评论