How do I plot differing length (X,Y) vectors vs time?

At each point in time I receive a list of (x,y) pairs and the number of data points ((x,y) pairs) varies with time. I want to do a scatter plot-style figure of the x,y pairs versus time. If it helps, the x,y pairs are integers over a finite range of possible values (range(x) is not = range(y)).

 Respuesta aceptada

Star Strider
Star Strider el 14 de Sept. de 2016
You probably have triplets (t,x,y). Use the scatter3 or plot3 functions. If you want to plot more than one (t,x,y) series on each plot, use the hold function.

4 comentarios

Dean Ranmar
Dean Ranmar el 14 de Sept. de 2016
Editada: Dean Ranmar el 14 de Sept. de 2016
Thanks. No, I don't have triplets. I have thought of 'holding' the plot and re-calling scatter with each new set and assigning a new color each time - very similar to what you say. It's night here so I will try again in the morning. Thanks, again. (Scatter3 doesn't seem to apply because I don't have triplets of data.)
Star Strider
Star Strider el 14 de Sept. de 2016
My pleasure.
If you want to plot as a function of time, one of your data vectors must be the time the data were acquired. If you don’t capture it directly, you can make a reasonable approximation if you sample it at regular intervals and know the approximate sampling time difference.
Dean Ranmar
Dean Ranmar el 15 de Sept. de 2016
Thanks again. Doing as you say and changing the color for each sample vector worked. I will post my/your solution in a couple of days in case anyone is interested. It's just a few lines of code and it yields very nice-looking plots.
Star Strider
Star Strider el 15 de Sept. de 2016
As always, my pleasure.
I’m interested! I’d like to see your code and the plot it produced.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 14 de Sept. de 2016

Comentada:

el 15 de Sept. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by