MATLAB中的三维图

MATLAB中的三维图

MATLAB中的三维图

在MATLAB中,我们可以绘制不同类型的模块,如2d绘图和3d绘图。在这篇文章中,我们将看到什么是3D绘图的各种类型。

网格图:网格图是一个三维曲面,它为不同类型的表达方式创建不同类型的网格。为了创建网格,我们必须给出z的值x和y,(z= f(x, y))。为了绘制网格图,它有mesh(),它将生成三维曲面。它有固体边缘颜色,但没有表面颜色。

语法:

mesh(Z)

示例:

% give the input of x and y.

[x,y]= meshgrid(0:0.1:5);

% give the expression for x

% and y for the output in z

z= sin(x).*cos(y);

% mesh() is used for 3D plotting

mesh(z);

输出:

曲面图。曲面图是一个三维曲面,它为不同的表达方式创建不同类型的曲面。要创建一个曲面,我们必须给出z的值x和y,(z= f(x, y))。为了绘制曲面图,它有surf(),它将生成三维曲面。它有固体边缘颜色和固体表面颜色

语法:

surf(Z)

示例:

% give the input for x and y

[x,y]= meshgrid(0:0.1:5);

% give the expression for

% x and y for the value of z.

z= sin(x).*cos(y);

% use surf() for the plotting

surf(z)

输出:

曲面图(带阴影)。曲面图可以创建一个三维的曲面图,它有实体的边缘颜色和实体的表面颜色,也有阴影。在带阴影的曲面图中,我们必须为z提供x和y的值,(z= f(x, y))。为了绘制曲面图,它有surf(z)被用于三维绘图。

语法:

surfl(z)

有三种类型的阴影可用。

遮阳平

阴影面

遮蔽性互换

示例:

% give the input for x and y

[x,y]= meshgrid(0:0.1:5);

% give the expression for x and y

% for the value of z

z= sin(x).*cos(y);

% use surfl() for the plotting

% shading faceted is by default

surfl(z)

shading faceted

title('Faceted Shading')

% use shading flat for each mesh

% line segment and face has a

% constant color

surfl(z)

shading flat

title('Flat Shading')

% use shading flat for varies the

% color in each line segment and

% face by interpolating

surfl(z)

shading interp

title('Interpolated Shading')

输出:

等高线图。等高线图也被称为线图。为了绘制等高线,它有x、y两个变量,用来给出z的值,(z=f(x, y))。x和y变量通常在一个叫做meshgrid的网格中。

语法:

contour(Z)

示例:

% enter the inputs of x and y

[x,y]= meshgrid(0:0.1:5);

% enter the expression using

% x and y

z= sin(x).*cos(y);

% use contour() for plotting

contour3(z,50)

输出:

曲线图。曲线图或矢量图是一种绘图类型,它使用笛卡尔分量x、y和z给出u、v、w的方向分量。

语法:

quiver3(X, Y, Z, U, V, W)

示例:

% give the input value for x,

% y and z

[x,y,z]= meshgrid(0:0.1:5);

% using x, y and z give the

% values for u,v and w

u= sin(x).*cos(y);

v= sin(x).*cos(y);

w= sin(x).*cos(y);

%use quiver3() for 3d plotting

quiver3(x,y,z,u,v,w);

输出:

相关推荐

【痴】可以组哪些词
Bet中文365

【痴】可以组哪些词

📅 08-02 👁️ 3145
放屁多还特别臭是怎么回事
Bet中文365

放屁多还特别臭是怎么回事

📅 07-21 👁️ 3643
幸福工厂
Bet中文365

幸福工厂

📅 07-21 👁️ 1532