Plotting 150 datapoints on a 360datapoint scale.
Mostrar comentarios más antiguos
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
Friedrich
el 14 de Mzo. de 2012
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
el 14 de Mzo. de 2012
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
el 14 de Mzo. de 2012
Thomas
el 14 de Mzo. de 2012
Seems like you need to interpolate the datapoints as mentioned by Wayne below..
Ferd
el 14 de Mzo. de 2012
Respuestas (1)
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.
Categorías
Más información sobre Signal Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!