I got a frequency of 6 - 16 Hz to pass through. but how do i determine what is my stopband?
xd = double(myRecording); % Convert to ‘double’
Fs = 8000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Fpb = [6 16]/Fn; % Passband
Fsb = []/Fn; % Stopband

 採用された回答

Star Strider
Star Strider 2015 年 3 月 4 日

0 投票

If you’re designing a bandpass filter, everything within [6 16] Hz (normalised by ‘Fn’ as you correctly compute) is your passband. Everything else is your stopband by definition, so you don’t need to define it specifically. If you need to define passband and stopband ripple (a requirment of buttord and related functions), choose 1 and 10 dB respectively.

4 件のコメント

Daemian
Daemian 2015 年 3 月 4 日
Yes, is for buttord. And what do you mean 1 and 10dB respectively?
Star Strider
Star Strider 2015 年 3 月 4 日
The 1 and 10 dB are the passband and stopband ripple, respectively. This is more important in the Chebyshev design than for Butterworth filters, but buttord wants them. Choose whatever values meet your needs. Note that the butter function simply wants the filter order and (for a bandpass filter) passband frequencies. It doesn’t need any other information unless you want to design a highpass or bandstop filter, then it needs a third argument specifying filter type.
I didn’t realise you’re using the buttord function. It does require you to specify the passband and stopband, as well as the ripple for both, so I usually specify the stopbands to be 0.8 and 1.25 times the passband frequencies. I always convert the filter to second-order-section representation for stability.
For your filter, this becomes:
Fs = 8000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Fpb = [6 16]/Fn; % Passband
Fsb = Fpb.*[0.8 1/0.8]; % Stopband
Rp = 1;
Rs = 10;
[n,Wn] = buttord(Fpb,Fsb,Rp,Rs);
[b,a] = butter(n,Wn);
[sos,g] = tf2sos(b,a);
figure(1)
freqz(sos,1024,Fs)
The freqz call lets you see what your filter looks like. Experiment with the stopband characteristics to get the result you want. You may want to widen them a bit.
Daemian
Daemian 2015 年 3 月 4 日
Sure thanks a lot :)
Star Strider
Star Strider 2015 年 3 月 4 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by