Hey!
I have the following problem: I have two vectors of pressure data, vector A taken at frequency 20000 Hz, vector B taken at frequency 1000 Hz.
Now I would like to get the difference in pressure B-A, but obviously I can't just subtract the two vectors given their different length.
Is there an elegant way to do this? Clearly it will involve averaging sections of vector A in order to bring down its size to that of vector B. I couldn't figure out a nice general way to do this, however.
Would be glad if someone could help! :)
-Alex

 채택된 답변

Star Strider
Star Strider 2019년 7월 5일

0 개 추천

The best way is to use the Signal Processing Toolbox resample (link) function to resample the 20000 Hz sampling frequency vector to the size (and sampling frequency) of the 1000 Hz sampling frequency vector. The resample function is best for this (rather than interp1), since it uses an anti-alliasing filter. This is important if you want to do signal processing on both of them later.

댓글 수: 2

Thank you very much!
My pleasure!
If my Answer helped you solve your problem, please Accept it!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by