Resampling a matrix of data to increase data sample rate
31 views (last 30 days)
Show older comments
humbleHacker
on 19 Mar 2019
Commented: Star Strider
on 19 Mar 2019
Hi,
I have two matrices (M1 and M2) of acquired data from disparate devices, each sampling at different sample rates. Data in M1 was acquried at 200Hz. Data in M2 was acquried at 400Hz. Both matrices have a timestamp column at column 1. M1 then has 4 columns representing acquired channel data at each timestamp. M2 has 6 columns, also representing acquried channel data.
I'm trying to resample the four data channels in M1 to increase their sample rate to 400Hz, to be in line with the data in M2.
I've tried using interpn() with some success when feeding in a single data channel from M1:
dev1Time = M1(:,1);
dev2Time = M2(:,1);
dev1Chan = M1(:,2);
vNew = interpn(dev1Time, dev1Chan, dev2Time);
Is there a way of performing this task on all data channels in M1 at the same time? Or do I just have to use a FOR loop to access each data channel separately?
Or would anyone be able to recommend a more appropriate method please?
0 Comments
Accepted Answer
Star Strider
on 19 Mar 2019
Use the Signal Processing Toolbox resample (link) function. It is specifically designed for signal resampling, and includes an anti-aliasing filter. It will resample matrices as well.
2 Comments
More Answers (0)
See Also
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!