赞
踩
1.线形图
1.1二维线形图
用plot函数绘制,顺序一般为自变量,因变量,线形,颜色,封闭标记等;如x=-pi:pi/10:pi;y=sin(x);plot(x,y,'--rs','LineWidth',2,'MarkerEdgeColor','k');其中s代表方框;一个窗口画多个图形用hold on,hold off实现;如t=0:pi/20:2*pi;plot(t,sin(t),'-.r*')hold on;plot(sin(t-pi/2),'--mo');plot(sin(t-pi),':bs');hold off;
1.2三维线形图
用plot3绘制三维线形图,如t=0:pi/50:10*pi;plot3(sin(t),cos(t),t);grid on;axis square;
2.条形图
2.1二维条形图
用bar或barh生成条形图,如x=-2.9:0.2:2.9;bar(x,exp(-x.*x));colormap hsv;
2.2三维条形图
用函数bar3或bar3h绘制三维条形图,顺序一般为自变量,因变量,条形宽度,默认为0.8,如Y=cool(7);subplot(3,2,1);bar3(Y,'detached');title('Detached');
subplot(3,2,2);bar3(Y,0.25,'detached');title('width=0.25');subplot(3,2,3);bar3(Y,'grouped');title('Grouped');subplot(3,2,4);bar3(Y,0.5,'grouped');title('width=0.5');
subplot(3,2,5);bar3(Y,'stacked');title('Stacked');subplot(3,2,6);bar3(Y,0.3,'stacked');title('width=0.3');colormap([1 0 0;0 1 0;0 0 1]);
3.饼图
3.1二维饼图
用pie函数画二维饼图,如X=[19.3 22.1 51.6;34.1 70.3 82.4;61.4 82.9 90.8;50.5 54.9 59.1;29.4 36.3 47.0];x=sum(X);explode=zeros(size(x));
[c,offset]=max(x);explode(offset)=1;h=pie(x,explode);
3.2三维饼图
用pie3函数绘制三维饼图;
4.直方图
用hist函数绘制直方图,如x=-2.9:0.1:2.9;y=randn(1000,1);hist(y,x);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。