ErkNis
ErkNis

Reputation: 19

Matlab - Mark specific points

I've a graph given by the set of vectors {Time1Vector,Height1Vector,Time2Vector,Height2Vector,Time3Vector,Height3Vector} which are ploted using:

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

The plot: enter image description here

I would like to mark the points where the graph change color, or really, where the Time/Height-data changes from 1 to 2 and 2 to 3. How can I accomplish this whitout having to make them stationary (The input-data is asked for in the beginning of the code so the points can't be fixed).

Upvotes: 1

Views: 5064

Answers (2)

0x90
0x90

Reputation: 40982

Here is an example of how to mark points in a basic matlab plot

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

Upvotes: 2

Dan
Dan

Reputation: 45752

You could just plot points over the end points of each of your vectors:

eg

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

Upvotes: 2

Related Questions