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

1 次查看(过去 30 天)
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)))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by