Plotting 150 datapoints on a 360datapoint scale.

2 次查看(过去 30 天)
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 个评论
Thomas
Thomas 2012-3-14
Seems like you need to interpolate the datapoints as mentioned by Wayne below..
Ferd
Ferd 2012-3-14
Yea, I'm trying all the different methods. (lol...)
Appreciate the advice and answers though.
Thanks

请先登录,再进行评论。

回答(1 个)

Wayne King
Wayne King 2012-3-14
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 个评论
Ferd
Ferd 2012-3-14
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 2012-3-19
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by