trazar una curva paramétrica usando un conjunto de datos ordenados en matlab

This is an elementary question, which I hope has an easier solution that the one I have: I have an Nx2 data A set which is a parametric curve in the 2D plane. The set A is ordered, it is the solution of a differential equation.

How do I plot this? There is scatter, but that may leave gaps (unless I make sure to add more points into the set, but I'd rather not do that).

También hay ezplot, but that is a bit annoying in that it only accepts functions as argument, so I have to create a function that interpolates each column of my data matrix A.

There must be a quick one-line way to "connect the dots" in a 2D data set?? The funny thing is, GNUplot does this automatically!...but unfortunately doesn't give the best looking plots, IMHO...

I found a similar question (http://stackoverflow.com/questions/7408320/plot-a-parametric-equation-in-matlab), but that is only for graphs of functions, which is not what I have

preguntado el 29 de agosto de 12 a las 09:08

2 Respuestas

If your points are ordered correctly with respect to the parameter, then you can simply plot each point as the corresponding row in your matrix. If your matrix is data then you can simply do

 x = data(:,1)
 y = data(:,2)
 plot(x,y)

You can obviously combine those 3 lines into one for compactness.

Respondido 29 ago 12, 10:08

Oh, ha, it's that easy, thank you! I thought plot was only for plotting graphs of functions and that it would interpret x as points input values of a function... - db1234

La respuesta es usar plot function. Suppose that your data is A:

plot( A(:,1),A(:,2));

Respondido 29 ago 12, 10:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.