# How can I normalize my filter?

40 views (last 30 days)
Amy Lg on 30 Mar 2022
Commented: Star Strider on 7 Apr 2022
Hi,
I am applying a low pass filter to my signal and I should make sure the transfer function of my filter is one. How can I check it?
If the filter is not normalized, how can I normalize it?
I am learning about filters and I appreciate any help.
%lowpass filter
sig = MY SIGNAL;
sig_length = 5000001; % my signal length
fs = 1e13 % sampling rate
fc = 3e9; % cutt off frequency
order = 4;
wo = 2*pi*fc;
[z,p,k] = besself(order, wo,'low'); % zero, pole and gain form
% Convert to digital fileter
[zd,pd,kd] = bilinear(z,p,k,fs); % z-domain zero/pole/gain
[sos,g] = zp2sos(zd,pd,kd); % convert to second order section
filteredSignal = filtfilt(sos, g, sig);
Star Strider on 7 Apr 2022
Right.
In spite of everything I wrote in my answer (now deleted) and the observation in the Wikipedia article (and every signal processing textbook I consulted on this), you are still going to try to use the bilinear function to discretise a Bessel filter!
That is not going to work, and no amount of wishful thinking on your (or anyone else’s) part is ever going to make it work!

Paul on 3 Apr 2022
Why is fs defined and then multiplied by 1e9 in the call to bilinear? Which I guess might be o.k. but perhaps isn't what was intended?
Anyway, without that scaling the discrete filter output from bilinear() looks like it has just about the same response as the continuous filter. To show that, I modified the code to use
fs = 10000e9 % sampling rate
fs = 1.0000e+13
fc = 3e9; % cutt off frequency
order = 4;
wo = 2*pi*fc;
[z,p,k] = besself(order, wo,'low'); % zero, pole and gain form
% Convert to digital fileter
[zd,pd,kd] = bilinear(z,p,k,fs); % just use fs
Now compare the analog and discrete filters (I'm used to using Control System Toolbox functions, I'm sure the same plots can be obtained with Signal Processing Toolbox functions).
hc = zpk(z,p,k);
hd = zpk(zd,pd,kd,1/fs);
bode(hc,hd); Pretty good match until close to the Nyquist freqency pi*fs = pi*1e13.
As for the question about normalization, I'm not quite sure what "make sure the transfer function of my filter is one" means. Clearly, the tf can't be one at all frequencies. If just looking to ensure the dc gain is one, then we can check this with
format long e
freqresp(hc,0)
ans =
1
freqresp(hd,0)
ans =
9.999999999999665e-01
which may be close enough to one for all practical purposes.
Amy Lg on 6 Apr 2022
Thank you very much for your detailed answer and helping me to understand this.