Plotting the difference between 2 vectors points in 2D
Mostrar comentarios más antiguos
I have two vectors [x1,x2...xn] and [y1,y2...yn]. y is simply a noisy version of x. After plotting x on a 2D graph with connected points, I would like to plot just the points of y, with a straight line connecting each point of y to the corresponding "true" point in x. Thanks!
Respuestas (1)
Walter Roberson
el 22 de Abr. de 2012
Provided that the original x and y are row vectors,
hold on
h = plot([x; y]);
set(h, 'Color', 'k')
The 'k' means black, a color I chose arbitrarily for this purpose. Without that set() call, each of the lines will show up a different color.
2 comentarios
Matt
el 22 de Abr. de 2012
Walter Roberson
el 22 de Abr. de 2012
h = plot(t, [x;y])
You need to be consistent on your x axis coordinates.
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!