2013-04-24 119 views
1

我已經由該組矢量{Time1Vector,Height1Vector,Time2Vector,Height2Vector,Time3Vector,Height3Vector} ,其被使用ploted給出的曲線圖:Matlab的 - 標記特定點

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

情節:enter image description here

我想標記圖形顏色變化的地方,或者真的,其中時間/高度數據從1變爲2和2變爲3.我怎樣才能完成這個消除不得不讓它們靜止(輸入數據在代碼的開頭被要求,所以點不能被修復)。

+0

既然你有時間和高度向量,我假設你知道數據的時間和地點情節的變化,即使其從運行到運行的動態。一旦你知道顏色變化的座標,你可以使用下面的函數/命令:http://www.mathworks.com/help/matlab/creating_plots/adding-text-annotations-to-graphs.html – anonymous 2013-04-24 18:44:13

回答

2

你可以只點積在每個向量的終點:

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

謝謝,偉大的方法! – ErkNis 2013-04-24 18:52:30

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