Вопрос

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).

There is also 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

Это было полезно?

Решение

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.

Другие советы

The answer is using plot function. Suppose that your data is A:

plot( A(:,1),A(:,2));
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top