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!