How do I resample data from 1 sample per second to 50 samples per second?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Thomas Gunther
le 18 Juin 2018
Commenté : Thomas Gunther
le 18 Juin 2018
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 commentaire
dpb
le 18 Juin 2018
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));
Réponse acceptée
Ameer Hamza
le 18 Juin 2018
Modifié(e) : Ameer Hamza
le 18 Juin 2018
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)))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calendar dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!