How to design a butterworth filter for velocity data?

3 次查看(过去 30 天)
Hi guys,
I have only just started learning about filters and am having some trouble/questions. I am working with the energy spectrum from velocity data and I would like to do a high-pass butterworth filter with a cut-off frequency of 0.5Hz. I have written a code. However, when I apply it, my velocities increase from 0.5 to 20 or more! And when I use pwelch to plot my spectrum, the energy values increase tremendously, which is definetely wrong.
n = 5; % order of the Butterworth filter
fc = 0.5; % Cut-off frequency in Hz
fs = 8; % Sampling frequency in Hz
[a,b] = butter(n,fc/(fs/2),'high');
Veloc = filter(b,a,Veloc);
For me, the way I have designed, I should be basically filtering out signals with a lower frequency than 0.5Hz, but that's obviously not what is going on. Can someone tell me what I am doing wrong?
If I use filtfilt instead of filter, I get only NaN.
Thanks so much for the help! I am really struggling with this.

回答(0 个)

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by