Plotting 150 datapoints on a 360datapoint scale.

1 visualización (últimos 30 días)
Ferd
Ferd el 14 de Mzo. de 2012
Hey
How do you plot an extracted list having 150 datapoints against a 360 datapoints x-scale? If you would do it in Excel, one would have to insert zeros in those empty cells. In matlab, would using vectors work? If not, what would be the best and easiest answer?
Thanks
Ferd
  5 comentarios
Thomas
Thomas el 14 de Mzo. de 2012
Seems like you need to interpolate the datapoints as mentioned by Wayne below..
Ferd
Ferd el 14 de Mzo. de 2012
Yea, I'm trying all the different methods. (lol...)
Appreciate the advice and answers though.
Thanks

Iniciar sesión para comentar.

Respuestas (1)

Wayne King
Wayne King el 14 de Mzo. de 2012
You can do the same thing as in Excel, you can upsample the vector by two and plot that.
Or you can interpolate to get an estimate of what the data vector is on a finer grid.
If you have the Signal Processing Toolbox, there is function upsample()
t = 1:300;
x = randn(150,1);
y = upsample(x,2,0);
stem(t,y);
To interpolate, you can use interp1().
t = 1:1/2:150;
x = randn(150,1);
t1 = 1:150;
y = interp1(t1,x,t);
plot(t,y);
There are a number of supported interpolation methods. You should choose which is most appropriate for you use case.
  2 comentarios
Ferd
Ferd el 14 de Mzo. de 2012
Hey Wayne,
I believe both answers would modify the final output to get it in the required box of 360points. However, I have those final points. Next, i would like to plot that 150 (x,y)points on a 360x360 global plot. Both the extracted list and the global plot have same axis units. i am thinking just a vector subtraction w.r.t origin might be ok to get both matrices in the same order.
Ferd
Ferd el 19 de Mzo. de 2012
Hey
No positive results yet.
I have two channels, Timings and fuel-in. The Timing matrix ranges from -12 to +10 (dbtdc) and my fuelling is in mg/stroke. Both the matrices are 160x1. Now, I have created a new CAD scale from -180 to +180(degrees) having an interval of 1degree(360x1)Matrix. I intend to plot the Timing channel on my newly created CAD scale so as to get data for only the fuelling event to be represented on the -180 to 180 cycle.
Thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by