How do I resample data from 1 sample per second to 50 samples per second?

1 回表示 (過去 30 日間)
Thomas Gunther
Thomas Gunther 2018 年 6 月 18 日
コメント済み: Thomas Gunther 2018 年 6 月 18 日
I am collecting data from an Avionics device which provides 1 sample per second sampling rate. I have the ability to get the .csv file that is generated by this equipment and read it into my MATLAB environment with the Textscan command which I set up as a variable d1. From there, I am able to create my Array and separate out my time vector and data vector to define my timeseries as follows:
A_1=[d1{:}]; %Vector Array of d1 data;
t1 = A_1(:,1); % Time Vector at 1 sample/sec;
data1 = A_1(:,2:end); % Measured data in Array;
ts1 = timeseries(data1, t1); %Timeseries variable for t1;
Can anyone please provide some details or guidance on what steps to take or define to go from a 1-Sample/sec sampling rate to 50-Samples/sec sampling rate through the use of the resample command which will allow me to view the effects of my data at the higher sampling rate? Thank you.
  1 件のコメント
dpb
dpb 2018 年 6 月 18 日
There are no "effects" in the data of a higher sampling rate excepting for interpolation of the existing data. How well that works depends entirely on the (unknown) characteristics of the actual signal between the sample points--if it's relatively smooth, may be reasonable, otherwise is anybody's guess.
But, to use resample is pretty-much "dead ahead";
sampled=resample(data(50,1));

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

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 6 月 18 日
編集済み: Ameer Hamza 2018 年 6 月 18 日
You can use interp1 to resample the data by interpolation. For example, try
t1_resampled = interp1(linspace(0, 1, length(t1)), t1, linspace(0, 1, 50*length(t1)));
data1_resampled = interp1(linspace(0, 1, length(data1)), data1, linspace(0, 1, 50*length(data1)))
  1 件のコメント
Thomas Gunther
Thomas Gunther 2018 年 6 月 18 日
Thankk you Ameer. I will try this process you defined above.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalendar についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by