Band Pass Filter Design
古いコメントを表示
Hello everyone, I am trying to build a bandpass filter in matlab for an EMG signal. I know I want the band to be between 10 and 500 Hz. However, using fdesign.bandpass function it gives me many parameters ('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'). Which value should I use for each parameter? I appreciate the help.
回答 (1 件)
Star Strider
2018 年 11 月 7 日
Otherwise, try this:
t = your_time_vector;
EMG = your_signal;
Fs = ...; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = [10 500]/Fn; % Passband Frequency Vector (Normalised)
Ws = [8 510]/Fn; % Stopband Frequency Vector (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 50; % Stopband Attenuation (dB)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Calculate Filter Order
[z,p,k] = ellip(n,Rp,Rs,Wp,'bandpass'); % Default Here Is A Lowpass Filter
[sos,g] = zp2sos(z,p,k); % Use Second-Order-Section Implementation For Stability
EMG_filtered = filtfilt(sos,g,EMG); % Filter Signal (Here: ‘EMG’)
figure
freqz(sos, 2^14, Fs) % Bode Plot Of Filter
% set(subplot(2,1,1), 'XLim',[0 Fn]) % Optional, Change Limits As Necessary
% set(subplot(2,1,2), 'XLim',[0 Fn]) % Optional, Change Limits As Necessary
figure
plot(t, EMG_filtered)
grid
Note that your sampling frequency ‘Fs’ must be greater than 1000 Hz for this filter to work. The upper limit of your filter passband must be less than the Nyquist frequency.
2 件のコメント
Ricardo Whitaker
2018 年 11 月 10 日
Star Strider
2018 年 11 月 10 日
My pleasure.
First: there was a slight error in the passband and stopband frequency vectors.
Use these instead:
Wp = [10 495]/Fn; % Passband Frequency Vector (Normalised)
Ws = [ 8 498]/Fn; % Stopband Frequency Vector (Normalised)
Second: ‘Note that your sampling frequency ‘Fs’ must be greater than 1000 Hz for this filter to work. The upper limit of your filter passband must be less than the Nyquist frequency.’
Third: If you want a highpass filter instead of a bandpass filter with a sampling frequency of 1000 Hz, change these lines to:
Wp = 10/Fn; % Passband Frequency Vector (Normalised)
Ws = 8/Fn; % Stopband Frequency Vector (Normalised)
. . .
[z,p,k] = ellip(n,Rp,Rs,Wp,'high'); % Default Here Is A Lowpass Filter
If your sampling frequency is 1000 Hz, and you want to pass all frequencies above 10 Hz, that will design a sufficient filter.
カテゴリ
ヘルプ センター および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!