Hi,
I have RPM trace signal (respiratory data) sampled at 26 Hz. I want to downsample RPM trace signal to 5.2 Hz. Does anyone know how to downsample this trace signal to 5.2 Hz?
Thanks in advance.

 Accepted Answer

I assume that the signal is sampled regularly, and a fixed sampling interval.
Use the Signal Processing Toolbox resample function. It will do exactly what you want.
A prototype call to it would be:
RPMrs = resample(RPM, 52, 260);
so the output will be sampled at 5.2/26 of the original rate.
To calculate a new time vector for it, use the linspace function.
Note that if it is not uniformly sampled, first follow the procedure in Resample a Nonuniformly Sampled Data Set, then do the rate resampling.

15 Comments

Thank you very much for your kind and positive reply. It worked perfectly. Thanks once again.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
@Asad, You should see a button close to this answer that says 'accept answer' or something similar. You should click that button instead of flagging this comment.
copy of flag by Asad Rasheed:
This person helped me to solve my problem
Thanks for the kind information. I have done it
@Asad Rasheed — Thank you!
@Rik — Thank you!
MAT-Magic
MAT-Magic on 21 Jan 2020
Edited: MAT-Magic on 21 Jan 2020
@Star Strider, After creating new time vector as you suggested me earlier, I checked sampling intervals between any two adjacent instants of three different RPM signals, which are 0.1928s, 0.1927s, 0.1929s, while my downsampling sampling interval is 0.1923s. The three sampling intervals coming same after the decimal, but different in every case for the last digit.
Question: Will it affect when I take the final RMSE of three RPM signals?
t_new = linspace(t_previous(1), t_previous(end), length(RPMrs));
I am waiting for you kind answer. Thanks
As always, my pleasure.
Ideally, the time vectors should be the same. Differences could arise if the original data were not uniformly sampled (use the resample function with a different syntax to correct for that, see: Resample a Nonuniformly Sampled Data Set), or if the vectors were originally of different lengths.
The time vector should not affect the RMSE calculation, because as I recall, the time does not directly enter into that calculation. (It is the square root of the mean of the squared differences over the entire signal.) If you are subtracting one vector from another, those vectors of course have to have the same lengths and be sampled at the same time instants.
Thanks. I will try to use the "Resample a Nonuniformly Sampled Data Set" as resamping of my nonuniform sampled data.
As always, my pleasure!
WOW, It worked. Thanks Sir
Finally I downsampled the signal from 26 Hz to 5.2 Hz with equally spaced uniform time interval.
As always, my pleasure!
Nonuniformly-sampled signals require a two-step process.
MAT-Magic
MAT-Magic on 22 Jan 2020
Edited: MAT-Magic on 22 Jan 2020
@Star Srider, Thanks for the reply.
But here, my downsampling process is only one-step process by using this method "Resample a Nonuniformly Sampled Data Set" (as you suggested) which is given below in form of prototype like;
[RPMrs, tvrs] = resample(RPM, t, Fs, 3, 1);
where,
RPM = Given signal.
t = Time information of the given signal.
Fs = Downsampling frequency (5.2 Hz);
Question-1: Still I don't know how to decide the fourth and fifth arguments of above prototype in every case (especially in my case)?
Question-2: If above prototype will be the first step, then what will be second step of Nonuniformly-sampled signals?
Thanks for bearing my questions. Waiting for your kind reply. Bundle of thanks in advance.
Regards
As always, my pleasure!
First, for best results, always return the new time vector (that I call ‘tvrs’ here):
[RPMrs, tvrs] = resample(RPM, t, Fs, 3, 1);
As noted in the documentation, this resamples ‘RPM’ to the new time vector, and also upsamples it by a factor of 3/1 (determined by the last two arguments in this call to resample). If you do not want to upsample or downsample it, omit the last two arguments:
[RPMrs, tvrs] = resample(RPM, t, Fs);
That should do what you want.
Thank you so much Sir !!!
As always, my pleasure!

Sign in to comment.

More Answers (0)

Products

Asked:

on 10 Jan 2020

Edited:

on 22 Jan 2020

Community Treasure Hunt

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

Start Hunting!