Plotting 150 datapoints on a 360datapoint scale.
显示 更早的评论
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 个评论
Friedrich
2012-3-14
Do you know to which x value each of your 150 datapoints belongs to?
Lets say i have as
x = [1 2 3 4 5]
and as
y = [10 20]
How do you know to which x value the y value corresponds?
Thomas
2012-3-14
can you show an example of your data? Do you mean to say you have 360 values in x and 150 values in Y and are plotting(x,y)?
Ferd
2012-3-14
Thomas
2012-3-14
Seems like you need to interpolate the datapoints as mentioned by Wayne below..
Ferd
2012-3-14
回答(1 个)
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Signal Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!