comet
二维彗星图
说明
示例
创建彗星图
创建 y
中数据对 x
中数据的彗星图。将 y
创建为正弦函数值向量,输入值介于 0 到 之间。将 x 创建为余弦函数值向量,输入值介于 0 到 之间。在各值之间使用递增量 。然后绘制数据图。
t = 0:pi/100:2*pi; y = sin(t); x = cos(t); comet(x,y)
控制彗星主体长度
创建一个彗星图,并通过设置缩放因子输入 p
来指定彗星主体的长度。彗星主体是位于头部后的尾部段,此尾部段以不同颜色开始,但会渐变为相同颜色。
将 x
和 y
创建为三角函数向量,输入值介于 0 到 之间。将 p
指定为 0.5,以使彗星主体长度为 0.5*length(y)
。然后绘制数据图。
t = 0:pi/50:4*pi; x = -sin(t) - sin(t/2); y = -cos(t) + cos(t/2); p = 0.5; comet(x,y,p)
在指定坐标区中创建绘图
通过指定每个图的目标坐标区,在分块图布局中创建两个彗星图。将两个数据集 x1
和 y1
以及 x2
和 y2
创建为三角函数向量,输入值介于 0 到 之间。将主体长度缩放因子 p
指定为 0.25,以使主体长度为 0.25*length(y)
。
t = 0:pi/20:4*pi; x1 = -cos(t) + cos(t/2); y1 = -sin(t) - sin(t/2); x2 = cos(t) - cos(t/2); y2 = -sin(t) - sin(t/2); p = 0.25;
将这两个 Axes
对象存储为 ax1
和 ax2
。通过包含 Axes
对象作为 comet
的第一个输入参数,为每个彗星图指定目标坐标区。
tiledlayout(1,2); ax1 = nexttile; ax2 = nexttile; comet(ax1,x1,y1,p) comet(ax2,x2,y2,p)
输入参数
p
— 彗星主体长度缩放因子
0.1
(默认) | [0, 1) 范围内的标量
彗星主体长度缩放因子,指定为区间 [0, 1) 范围内的值。彗星主体长度为 p*length(y)
。
ax
— 目标坐标区
Axes
对象 | GeographicAxes
对象
目标坐标区,指定为 Axes
对象或 GeographicAxes
对象。
局限性
彗星图不支持数据提示。
扩展功能
GPU 数组
通过使用 Parallel Computing Toolbox™ 在图形处理单元 (GPU) 上运行来加快代码执行。
用法说明和限制:
此函数接受 GPU 数组,但不在 GPU 上运行。
有关详细信息,请参阅Run MATLAB Functions on a GPU (Parallel Computing Toolbox)。
分布式数组
使用 Parallel Computing Toolbox™ 在集群的组合内存中对大型数组进行分区。
用法说明和限制:
此函数在分布式数组上运行,但在客户端 MATLAB® 中执行。
有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
版本历史记录
在 R2006a 之前推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)