Plotting 150 datapoints on a 360datapoint scale.
2 views (last 30 days)
Show older comments
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 Comments
Thomas
on 14 Mar 2012
Seems like you need to interpolate the datapoints as mentioned by Wayne below..
Answers (1)
Wayne King
on 14 Mar 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.
See Also
Categories
Find more on Geographic Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!