《Matlab数据可视化示例.docx》由会员分享,可在线阅读,更多相关《Matlab数据可视化示例.docx(2页珍藏版)》请在优知文库上搜索。
1、绘制直方图X=randn(100OJ;subplot(l,2,1;hist(x;subplot(1,2,2;hist(x,8;25030020025020015015010010050500-4-20240420246.离散数据图形:StenI(x,yZstairs(x,y/stem3(x,y,z二维离散图形、二维阶跃图形、三维离散图形X=0:10:360*pi/180;y=sin(x;SUbPIot(2,2,1;Plot(X,y;subplot(2,2,2;stem(x,y;subplot(2,2,3;stairs(x,y;t=0:0.1:10;S=0.1+i;y=ex(-s*t;SUbPI
2、ot(2,2,4;Stem3(real(y,imag(y,t;10.50-0.5-110.50-0.5-1024680246810.50-0.5-110501002468-1-1017.等值线图:contour(x,y,z,n绘制二维等值线n=-2:0.2:2;X,Y,Zj=peaks(n;contour(X,Y,Z,10;21.510.50-0.5-1-1.5-2-2-1.5-1-0.500.511.528.等值线图(符号函数):ezcontour(f,domain,n/ezcon1.ourf(f,domain,n绘制符号函数的等值线。绘制函数f(X,y3(1X2ex2(y122222X11
3、0(x3y5eXye(x1y53symsxy;f=3*(l-2*cxp(-(x2-(y+l2.-10*(x5-3-y5*exp(-2-y2.-13*exp(-(x+12-y2;subplot(1,2,1Jezcontour(f,-3l3,49;title(,contour*;subplot(l,2,2;ezcontourf(f,-3,3,49;title(,filledcontour:contour33filledcontour221100yTy-20x2T-2-2-3-3-20x29.矢量图:quiver(x,y,u,v绘制矢量像(x,y是坐标,(u,V是待绘制的矢量n=-2:0.2:2;X,Y,Z=peaks(n;contour(X,Y,Z,10;U,V=gradient(Z,0.2:holdonquiver(X,Y,U,V;contour321.52110.500-0.5-1-1-2-1.5-3-2-2y-20x2-1012