快捷搜索:  汽车  科技

matlab三维图形教程(周一分享十五)

matlab三维图形教程(周一分享十五)Share interest spread happiness本期推文阅读时长大约5分钟,请您耐心阅读。这里是LearingYard学苑!今天小编为大家带来Matlab三维绘图。欢迎您的用心访问!

Matlab三维绘图

Matlab 3D plot

matlab三维图形教程(周一分享十五)(1)

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

亲爱的您,

这里是LearingYard学苑!

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

欢迎您的用心访问!

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

Share interest spread happiness

increase knowledge and leave beautiful.

Dear you

this is the LearingYard Academy!

Today the editor brings three-dimensional drawing in Matlab.

Welcome your visit!

The reading time of this tweet is about 5 minutes please read it with patience.

一、三维绘图基本语法

3D Drawing Basic Syntax

1.plot3——三维点或线图

plot3 - 3D point or line plot

  • plot3(X Y Z)绘制三维空间中的坐标。
  • plot3(X Y Z LineSpec)使用指定的线型、标记和颜色创建绘图。
  • plot3(X1 Y1 Z1 ... Xn Yn Zn)在同一组坐标轴上绘制多组坐标。
  • plot3(X1 Y1 Z1 LineSpec1 ... Xn Yn Zn LineSpecn)可为每个XYZ三元组指定特定的线型、标记和颜色。
  • plot3(___ Name Value)使用一个或多个名称值对组参数指定Line属性。
  • plot3(X Y Z) plots coordinates in three-dimensional space.
  • plot3(X Y Z LineSpec) creates a plot with the specified linetype markers and colors.
  • plot3(X1 Y1 Z1 ... Xn Yn Zn) plots multiple sets of coordinates on the same set of axes.
  • plot3(X1 Y1 Z1 LineSpec1 ... Xn Yn Zn LineSpecn) assigns a specific linetype marker and color to each XYZ triple.
  • plot3(___ Name Value) specifies the Line property using one or more name-value pair arguments.

2.bar3——绘制三维条形图

bar3 - draws a 3D bar chart

  • bar3(Z)绘制三维条形图,Z中的每个元素对应一个条形图。
  • bar3(Y Z)在Y指定的位置绘制Z中各元素的条形图,其中Y是为垂直条形定义y值的向量。
  • bar3(... width)设置条形宽度并控制组中各个条形的间隔。
  • bar3(... style)指定条形的样式。
  • bar3(... color)使用color指定的颜色显示所有条形。
  • bar3(Z) draws a three-dimensional bar chart one for each element in Z.
  • bar3(Y Z) draws a bar graph of the elements in Z at the positions specified by Y where Y is a vector defining the y-values for the vertical bars.
  • bar3(... width) sets the bar width and controls the spacing of the bars in the group.
  • bar3(... style) specifies the style of the bar.
  • bar3(... color) displays all bars using the color specified by color.

3.histogram2——二元直方图

histogram2 - binary histogram

  • histogram2(X Y)创建X和Y的二元直方图。
  • histogram2(X Y nbins)指定要在直方图的每个维度中使用的bin数量。
  • histogram2(___ Name Value)使用前面的任何语法指定具有一个或多个 Name Value对组参数的其他选项。
  • histogram2(X Y) creates a binary histogram of X and Y.
  • histogram2(X Y nbins) specifies the number of bins to use in each dimension of the histogram.
  • histogram2(___ Name Value) uses any of the preceding syntaxes to specify additional options with one or more Name Value pair arguments.

4.pie3——三维饼图

pie3 - 3D pie chart

  • pie3(X)使用X中的数据绘制三维饼图。X中的每个元素表示饼图中的一个扇区。
  • pie3(X explode)指定是否从饼图中心将扇区偏移一定位置。
  • pie3(... labels)指定扇区的文本标签。
  • pie3(X) draws a 3D pie chart using the data in X. Each element in X represents a slice in the pie chart.
  • pie3(X explode) specifies whether to offset the slice from the center of the pie by a certain position.
  • pie3(... labels) specifies the text labels for the sector.

5.stem3——三维离散序列数据

stem3 - 3D discrete sequence data

  • stem3(Z)将Z中的各项绘制为针状图,这些针状图从X-Y平面开始延伸并在各项值处以圆圈终止。X-Y平面中的针状线条位置是自动生成的。
  • stem3(X Y Z)将Z中的各项绘制为针状图,这些针状图从X-Y平面开始延伸,其中X 和Y指定X-Y平面中的针状图位置。X、Y和Z输入必须是大小相同的向量或矩阵。
  • stem3(___ 'filled')填充圆。
  • stem3(___ LineSpec)指定线型、标记符号和颜色。
  • stem3(___ Name Value)使用一个或多个名称值对组参数修改针状图。
  • stem3(Z) plots the terms in Z as needles extending from the X-Y plane and ending in circles at the value of each term. The needle line position in the X-Y plane is automatically generated.
  • stem3(X Y Z) draws the terms in Z as needles extending from the X-Y plane where X and Y specify the needle positions in the X-Y plane. The X Y and Z inputs must be vectors or matrices of the same size.
  • stem3(___ 'filled') fills the circle.
  • stem3(___ LineSpec) specifies the line type marker symbol and color.
  • stem3(___ Name Value) modifies the stem using one or more name-value pair arguments.

6.scatter3——三维散点图

scatter3 - 3D scatter plot

  • scatter3(X Y Z)在向量X、Y和Z指定的位置显示圆圈。
  • scatter3(X Y Z S)使用S指定的大小绘制每个圆圈。
  • scatter3(X Y Z S C)使用C指定的颜色绘制每个圆圈。
  • scatter3(X Y Z) displays circles at the positions specified by the vectors X Y and Z.
  • scatter3(X Y Z S) draws each circle using the size specified by S.
  • scatter3(X Y Z S C) draws each circle using the color specified by C.

二、示例

Example

1.绘制多个线条

Draw multiple lines

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(2)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(3)

2.指定等间距刻度单位和轴标签

Specify equally spaced tick units and axis labels

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(4)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(5)

3.绘制三维条形图

Plot a 3D Bar Chart

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(6)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(7)

4.绘制二维直方图

Plot a 2D histogram

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(8)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(9)

5.绘制三维饼图

Draw a 3D Pie Chart

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(10)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(11)

6.绘制三维针状图

Draw a 3D needle diagram

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(12)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(13)

7.绘制三维散点图

Plot a 3D Scatter Plot

代码如下图所示:

The code is shown below:

matlab三维图形教程(周一分享十五)(14)

运行结果如下图所示:

The running result is shown in the following figure:

matlab三维图形教程(周一分享十五)(15)

今天的分享就到这里了。

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

欢迎给我们留言,

让我们相约明天。

祝您今天过得开心快乐!

That's it for today'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学苑原创,如有侵权请在后台留言!

文字|Zheng

排版|Zheng

审核|任务达人

猜您喜欢: