matlab画三维立体图像(Matlab画函数图像)

分享兴趣,传播快乐,增长见闻,留下美好。

亲爱的您,

这里是LearingYard学苑!

今天小编为大家带来matlab三维绘图

欢迎您的用心访问!

本期推文阅读时长大约4分钟,请您耐心阅读。

Share interest, spread happiness, increase knowledge, and leave beautiful.

Dear you,

This is the LearingYard Academy!

Today, the editor brings you matlab three-dimensional drawing

Welcome your visit!

This tweet usually takes about 4 minutes to read, please read it patiently.

01

本期主题介绍

The topic of this issue

如果您了解过Matlab,

您肯定知道Matlab不只是计算!

Matlab还有一个强大的绘图功能!

本期话题将对matlab的三维图进行介绍。

请感兴趣的朋友和小编开启

学习Matlab的三维绘图之旅吧!

If you know Matlab,

You must know that Matlab is more than just computing!

Matlab also has a powerful drawing function!

The topic of this issue will introduce the three-dimensional drawing of matlab.

Please open it with interested friends and editors

Learn the journey of two-dimensional drawing in Matlab

02

Matlab三维绘图

Matlab 3D drawing

1.用plot绘制三维图形

Use plot to draw three-dimensional graphics

x=1:5;

y=6:10;

z=x+y;

z2=exp(x+y);

[x3,y3]=meshgrid(x,y);

z3=x3+y3;

plot3(x,y,z);

plot3(x,y,z2);

plot3(x3,y3,z3);

%mesh可以绘制一段区间的曲面,调用格式mesg(x,y,z)

%注意:在使用函数前,先对xy平面建立网格坐标:[x,y]=meshgrid(x,y)

%其中meshgrid为二维三维网格

mesh can draw a section of curved surface, call the format mesg(x,y,z)

Note: Before using the function, create grid coordinates on the xy plane: [x,y]=meshgrid(x,y)

Where meshgrid is a two-dimensional three-dimensional grid

2.绘制螺旋图

Draw a spiral graph

t=0:pi/60:10*pi;

x=sin(t);

y=cos(t);

plot3(x,y,t,&39;*-b&39;);

3.三维网格图

Three-dimensional grid map

mesh函数用于绘制三维网格图,其调用语法如下。

(1)mesh(x,y,z):绘制三维网格图,x、y、z 分别表示三维网格图形在 x 轴、y 轴和 z 轴 的坐标,图形的颜色由矩阵 z 决定。mesh(Z):绘制三维网格图,分别以矩阵 Z 的列下标、行下标作为三维网格图的 x 轴、y 轴的坐标。

注意事项:在使用函数前,需要先在xy平面建立网格坐标:[x,y]=meshgrid(x,y),然后再利用新的x,y计算网格上对应z的点,从而得到构建曲面所需的点,最后再使用mesh绘制整个图。

The mesh function is used to draw a three-dimensional grid graph, and its calling syntax is as follows.

(1) mesh(x,y,z): draw a three-dimensional grid graph, x, y, z represent the coordinates of the three-dimensional grid graph on the x-axis, y-axis and z-axis, respectively. The color of the graph is determined by the matrix z. mesh(Z): Draw a three-dimensional grid graph, and use the column subscripts and row subscripts of matrix Z as the coordinates of the x-axis and y-axis of the three-dimensional grid graph.

Note: Before using the function, you need to establish the grid coordinates in the xy plane: [x,y]=meshgrid(x,y), and then use the new x,y to calculate the point corresponding to z on the grid to get Construct the points needed for the surface, and finally use the mesh to draw the entire graph.

x=-8:8;

y=-8:8;

[X,Y]=meshgrid(x,y);

Z=(X.^2/4^2-Y.^2/5^2);

meshz(X,Y,Z)

4.绘制柱状图

Draw a histogram

bar3(x,y,z);

bar3(z3);

bar3(z3,&39;grouped&39;)

bar3(z3,&39;stacked&39;)

bar3(z3,0.3)

5.绘制直方图

Draw a histogram

%X = randn 返回一个从标准正态分布中得到的随机标量。

%X = randn(n) 返回由正态分布的随机数组成的 n×n 矩阵。

%X = randn(sz1,...,szN) 返回由随机数组成的 sz1×...×szN 数组,其中 sz1,...,szN 指示每个维度的大小。例如:randn(3,4) 返回一个 3×4 的矩阵。

%histogram为绘制直方图

%X = randn returns a random scalar obtained from the standard normal distribution.

%X = randn(n) returns an n×n matrix composed of normally distributed random numbers.

%X = randn(sz1,...,szN) returns an sz1×...×szN array composed of random numbers, where sz1,...,szN indicate the size of each dimension. For example: randn(3,4) returns a 3×4 matrix.

%histogram is to draw a histogram

x4=randn(100,1);

y4=randn(100,1);

histogram2(x4,y4);

6.绘制饼图

Draw a pie chart

pie3(z3)

7.绘制“火柴杆图”

Draw a &34;matchstick map&34;

%火柴杆数

% Matchsticks

stem3(x3,y3,z3)

t=-10:0.1:10;

xt=t;

yt=sin(t);

zt=exp(t);

stem3(xt,yt,zt,&39;filled&39;);

8.空间曲面绘图

Space surface drawing

%suf 空间曲面绘图

%surf(x,y,z)画出数据点x,y,z表示的曲面

%画出z=(x+y)^2

%suf space surface drawing

%surf(x,y,z) draws the surface represented by data points x,y,z

%Draw out z=(x+y)^2

x=-2:0.1:4;

y=1:0.2:8;

[x,y]=meshgrid(x,y);

z=(x+y).^3;

surf(x,y,z)

shaing flat

9.subplot的使用,以及shading自由设置图形表面的颜色

The use of subplot and shading freely set the color of the graphic surface

%shaing flat 使用同一种颜色配色

%shading interp 插值处理方式配色

%shaing flat uses the same color

%shading interp color matching

figure

subplot(1,3,1)

sphere(16)

axis equal

title(&39;Faceted Shading (Default)&39;)

subplot(1,3,2)

sphere(16)

shading flat

axis equal

title(&39;Flat Shading&39;)

subplot(1,3,3)

sphere(16)

shading interp

axis equal

title (&39;iInterpolated Shading&39;)

10.绘制极坐标图

Draw polar coordinates

a=10

k=2

theta=0:pi/50:2*pi;

r=a*sin(k*theta);

h=polar(theta,r)

set(h,&39;color&39;,[1,0,0],&39;LineWidth&39;,2)

今天的分享就到这里了。

如果您对今天的文章有独特的想法,

欢迎给我们留言,

让我们相约明天,

祝您今天过得开心快乐!

That&39;s it for today&39;s sharing.

If you have a unique idea about today’s article,

Welcome to leave us a message,

Let us meet tomorrow,

I wish you a happy day today!

LearningYard学苑

本文来自“有一人”用户投稿,该文观点仅代表作者本人,不代表华夏信息网立场,本站不对文章中的任何观点负责,内容版权归原作者所有、内容只用于提供信息阅读,无任何商业用途。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站(文章、内容、图片、音频、视频)有涉嫌抄袭侵权/违法违规的内容,请发送邮件至1470280261#qq.com举报,一经查实,本站将立刻删除、维护您的正当权益。如若转载,请注明出处:http://www.xxxwhg.com/cs/57723.html

上一篇 2023-01-07 23:30:32
下一篇 2023-01-06 02:25:01

相关推荐

  • matlab abs(matlab app开发 窗口隐藏)

    您好,今日小编就为大家解答这个问题。matlab app开发 窗口隐藏,matlab abs相信很多小伙伴还不知道,现在让我们一起来看看吧!1、功能:求复数实部与虚部的平方和的算术平方根格式:abs(x)例如:x=1+j;y=abs(x);>>y=1.4142描述:返回数字的绝对值。2、语法:Abs(number)

    2022-10-27 16:36:12
    282
  • matlab画三维图像(matlab画三维图像水瓶)

    Part 1直方图的绘制hist(a,b)a为要绘制的变量,b为柱形的个数。subplot(a,b,c)显示图像的位置布局,显示b行a列个图像,此图像是其中的第c个。hist(a,b)a is the variable to be drawn, and b is the number of bars.subplot(a,b,c) displays the position layout of the imag

    2022-11-19 10:58:13
    320
  • matlab开方函数是什么(matlab开方函数)

    您好,蔡蔡就为大家解答关于matlab开方函数是什么,matlab开方函数相信很多小伙伴还不知道,现在让我们一起来看看吧!1、matlab开方函数是sqrt(),用来计算一个非负实数的开方根,比如sqrt(4)=2。2、可以是一个数,也可以是一个矩阵。3、sqrt()函数的输入参数不允许为负数,若输

    2022-08-25 22:41:19
    263
  • MATLAB的length函数(matlab中length函数怎么使用)

    大家好,苏苏来为大家解答以上问题。MATLAB的length函数,matlab中length函数怎么使用很多人还不知道,现在让我们一起来看看吧!1、步首先,我们来看看长度函数在matlab中的用法。在命令行窗口输入helplength,可以看到length函数主要是求数组元素的个数,如下图所示:2、步骤

    2022-07-28 12:20:16
    291