全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 数据可视化
1228 1
2016-03-08

MATLAB课程:代码示例之Graphics and Visualization(二)


Creating 3-D Plots


This example shows how to create a variety of 3-D plots in MATLAB®.


Mesh Plot

The mesh function creates a wireframe mesh. By default, the color of the mesh is proportional to the surface height.

z = peaks(25);figuremesh(z)


Surface Plot

The surf function is used to create a 3-D surface plot.

surf(z)colormap(jet)    % change color map


Surface Plot (with Shading)

The surfl function creates a surface plot with colormap-based lighting. For smoother color transitions, use a colormap with linear intensity variation such as pink.

surfl(z)colormap(pink)    % change color mapshading interp    % interpolate colors across lines and faces


Contour Plot

The contour function is used to create a plot with contour lines of constant value.

contour(z,16)colormap default    % change color map


Quiver Plot

The quiver function plots 2-D vectors as arrows.

x = -2:.2:2;y = -1:.2:1;[xx,yy] = meshgrid(x,y);zz = xx.*exp(-xx.^2-yy.^2);[px,py] = gradient(zz,.2,.2);quiver(x,y,px,py)xlim([-2.5 2.5])    % set limits of x axis


Slices through 3-D Volumes

The slice function displays data at planes that slice through volumetric data.

x = -2:.2:2;y = -2:.25:2;z = -2:.16:2;[x,y,z] = meshgrid(x,y,z);v = x.*exp(-x.^2-y.^2-z.^2);xslice = [-1.2,.8,2];    % location of y-z planesyslice = 2;              % location of x-z planezslice = [-2,0];         % location of x-y planesslice(x,y,z,v,xslice,yslice,zslice)xlabel('x')ylabel('y')zlabel('z')




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-3-8 14:43:46
好厉害,好赞,有用,thanks for sharing。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群