Matlab - 标记特定点

时间:2013-04-24 18:30:15

标签: matlab plot

我有一组矢量{Time1Vector,Height1Vector,Time2Vector,Height2Vector,Time3Vector,Height3Vector}给出的图表 使用以下内容绘制:

plot(Time1Vector,Height1Vector,'g',Time2Vector,Height2Vector,'b',Time3Vector,Height3Vector,'r');

情节:enter image description here

我想标记图形改变颜色的点,或者实际上,时间/高度数据从1变为2和2到3的位置。如何实现这个必须使它们静止的输出(输入在代码的开头要求-data,因此无法修复点数。

2 个答案:

答案 0 :(得分:2)

以下是如何在基本matlab图中标记点的示例

x= 0:0.001:pi;
y= sin(x);
z = (y<0.9);
z1 = (y>0.4);
z = xor(z,z1);
plot(x,y);hold on
plot(x(z),y(z),'o')

enter image description here

答案 1 :(得分:2)

您可以在每个向量的终点上绘制点:

例如

plot(Time1Vector,Height1Vector,'g',Time2Vector,Height2Vector,'b',Time3Vector,Height3Vector,'r');
hold on
plot(Time1Vector(end),Height1Vector(end),'k^','markerfacecolor',[1 0 0]);
相关问题