1

我有一个由一组向量 {Time1Vector,Height1Vector,Time2Vector,Height2Vector,Time3Vector,Height3Vector} 给出的图表,这些图表使用以下方法绘制:

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

剧情:在此处输入图像描述

我想标记图形改变颜色的点,或者实际上,时间/高度数据从 1 变为 2 和 2 变为 3 的点。我怎样才能完成这个必须使它们静止(输入数据是在代码的开头要求,因此无法修复这些点)。

4

2 回答 2

2

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

例如

plot(Time1Vector,Height1Vector,'g',Time2Vector,Height2Vector,'b',Time3Vector,Height3Vector,'r');
hold on
plot(Time1Vector(end),Height1Vector(end),'k^','markerfacecolor',[1 0 0]);
于 2013-04-24T18:50:32.937 回答
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')

在此处输入图像描述

于 2013-04-24T18:48:26.237 回答