1
$\begingroup$

I'm trying to design digital Butterworth filter from scratch. First I use butterap to design an analog prototype to get zeros, poles and gain

[za, pa, ka] = buttap(n);

Here I set n = 5 for example and then convert it to transfer function to check its frequency response

[b, a] = zp2tf(za, pa, ka);
freqs(b, a);

enter image description here

From the figure above I know it's a lowpass filter with cutoff frequency $\Omega_c=1$.

Now I want to convert this analog filter to a half-band lowpass digital filter using bilinear transform, according to the documentation of MATLAB's bilinear.

% Strip any zeros at infinity
za = za(isfinite(za));
% Do bilinear transformation
pd = (2 * fs + pa) ./ (2 * fs - pa);
zd = (2 * fs + za) ./ (2 * fs - za);
kd = real(ka * prod(2 * fs - za) ./ prod(2 * fs - pa));
% Add extra zeros at -1 so the resulting system has equivalent numerator and denominator order.
zd = [zd; -ones(length(pd) - length(zd), 1)];

Then convert it to transfer function and look at the frequency response

[b, a] = zp2tf(zd, pd, kd);
figure; freqz(b, a);

My question is about the sampling frequency $f_s$. I want a half-band lowpass filter meaning that $\omega_c = 0.5\pi$. From the relationship between digital frequency and analog frequency $\omega = \Omega T$ I can derive that $T = 0.5\pi\ \text{s}$ and $f_s = 1/T = 2/\pi\ \text{Hz}$. The following figure shows the frequency response when I set fs = 2/pi

enter image description here

Apparently it doesn't have a -3 dB attenuation at $\omega = 0.5\pi$. Only when I set fs = 0.5 can I get the desired result:

enter image description here

Anyone can help me to find where am I wrong? Thank you in advance.

$\endgroup$

1 Answer 1

2
$\begingroup$

Bilinear transform has a nonlinear frequency mapping $$ \varOmega = \frac{2}{T}\tan{\frac{\omega}{2}} $$ Substituting $\varOmega = 1$ and $\omega = 0.5\pi$ into it and you can derive that $$ T = 2 $$ and thus $$ f_s = 0.5 $$

$\endgroup$
1
  • $\begingroup$ Thank you very much! $\endgroup$
    – DSP novice
    Jul 28 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.