plot

2 ビュー (過去 30 日間)
Baba
Baba 2011 年 11 月 17 日
i have a column of data that has 100 points I also have a time column which only has 10 points basically data was sampled at 10Hz, but my time vector contains time value for every 10th sample.
How would I plot this? I run into a problem since the vectors are of different size.
  2 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 17 日
Duplicate is at http://www.mathworks.com/matlabcentral/answers/21564-plot

サインインしてコメントする。

回答 (1 件)

bym
bym 2011 年 11 月 17 日
use interp1 to resample your time vector to match the data vector
  12 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 18 日
There is no method of creating empty spaces in a vector.
Note that if interp1() is used, use the 'linear','extrap' options.
You will also have to calculate the data point endpoints. But if you have already gone through the trouble of figuring out the endpoints, then you might as well use linspace()
Use the code from your other thread, but for the Time values, instead of passing in your 200159 and so on, pass in
Time = datenum(str2num(YourTimes.'));
and use the datetick suggestion,
datetick('x','HH:MM:SS.FFF')

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by