Implementation of Narrow band pass filter ( Butterworth)

54 ビュー (過去 30 日間)
Bharath
Bharath 2015 年 3 月 19 日
コメント済み: Star Strider 2021 年 2 月 18 日
Hi all,
I'm struggling with implementation of narrow band pass filter. I understand from few suggestions (feedback) that it's too narrow and impulse is becoming too large. I also tried using the decimation but even it didn't work. I've posted my question in stackoverflow. Here is the link to it.
Could someone help me to solve this. Since this is part of my project. I'm little running short of time.
Thanks in advance for all your help and suggestion.

採用された回答

Star Strider
Star Strider 2015 年 3 月 19 日
編集済み: Star Strider 2015 年 3 月 19 日
This seems to work, although freqz has problems with it for some reason:
% DEFINE FILTER PARAMETERS
Fs = 2E+6;
Fn = Fs/2;
Fc1 = 630;
Fc2 = 640;
Fs1 = Fc1*0.8;
Fs2 = Fc2/0.8;
Rp = 1;
Rs = 10;
% DESIGN FILTER
[n,Wn] = buttord([Fc1 Fc2]/Fn, [Fs1 Fs2]/Fn, Rp, Rs);
[b,a] = butter(n,Wn);
[sos,g] = tf2sos(b,a);
% CHECK FILTER PERFORMANCE
% figure(1)
% freqz(sos, 512, Fn)
s = zeros(1, Fs);
s(fix(Fs/2)) = 1; % Create Impulse Signal
y = filtfilt(sos, g, s); % Filter Signal
tfs = fft(y)./fft(s); % Calculate Transfer Funciton
Fv = linspace(0,1,length(s)/2+1)*Fn; % Frequency Vector
ix = 1:length(Fv); % Index Vector
figure(2)
plot(Fv, abs(tfs(ix)))
grid
axis([0 1000 ylim])
  31 件のコメント
Star Strider
Star Strider 2015 年 5 月 6 日
‘...same data set to extract another freqeuncy.’
That’s likely the problem. You have to design and test an entirely new filter to extract the second frequency. Filter design is heuristic and can be challenging, especially with the narrow passband filters you seem to need. You can use the essence of my code to help you with your design, but you have to determine the passband and stability of the second-order-section (SOS) implementation before you use it.
It is important to note that your wanting to design a filter to do a particular task does not mean that design is feasible. It might actually be easier to design and implement your filters in hardware and recording those filtered signals separately (along with your unfiltered signal) than to do the processing digitally. Narrowband hardware filters are easier to design and implement (at least in my experience) than narrowband digital filters.
Star Strider
Star Strider 2021 年 2 月 18 日
Harry — Were I to design that same filter today, I would do it differently, and use an elliptic filter instead of a Butterworth design:
% DEFINE FILTER PARAMETERS
Fs = 2E+6;
Fn = Fs/2;
Fc1 = 630;
Fc2 = 640;
Fs1 = Fc1*0.8;
Fs2 = Fc2/0.8;
Rp = 1;
Rs = 10;
% DESIGN FILTER
[n,Wp] = ellipord([Fc1 Fc2]/Fn, [Fs1 Fs2]/Fn, Rp, Rs);
[z,p,k] = ellip(n,Rp,Rs,Wp);
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^14, Fs)
The design procedure apparently appears to be important in producing the correct filter result, since even the Butterworth design is significantly impproved:
% DESIGN FILTER
[n,Wn] = buttord([Fc1 Fc2]/Fn, [Fs1 Fs2]/Fn, Rp, Rs);
[z,p,k] = butter(n,Wn);
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^14, Fs)
I have built a number of hardware filters, however they were all op-amp active filters with discrete components (and none recently), not FPGA filters.
See if this approach produces a better result.
Please post back with a Comment reporting the result you get, and how it works in the FPGA implementation.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by