Downsampled data exceeds the input data
Show older comments
I have an input data sampled at 64 Hz and I want it converted to 60Hz. I tried using 'resample' function and 'downsample' function within matlab,but in both the cases the output data exceeds the input data at some sample points. For example, the input data contains angles in degrees which is under -180 deg to +180 deg, but the downsampled data contains 220 deg,which is wrong. how to avoid these?
In the attached picture, you can find all the input and output are overlayed. Can someone please help me?
2 Comments
Mathieu NOE
on 18 Nov 2022
hello
for the resampling task , use interp1 with a new time vector defined at rate = 60 Hz
to avoid data above / below +/- 180 ° use wrap
Chandramouli Jambunathan
on 18 Nov 2022
Accepted Answer
More Answers (1)
Jan
on 18 Nov 2022
0 votes
A linear interpolation avoids output points outside the range of input point. Use interp1 or the modern and faster griddedInterpolant .
A fast C-mex function for this job: https://www.mathworks.com/matlabcentral/fileexchange/25463-scaletime
3 Comments
Chandramouli Jambunathan
on 18 Nov 2022
Jan
on 18 Nov 2022
I do not understand the meaning of "Both 'interp1' and 'griddedInterpolant' function expects specific data points". But Mathieu has show already, how to use these interpolation methods.
Chandramouli Jambunathan
on 18 Nov 2022
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!