11.4 IIR Filter Design 669
hpf = (3.01 + alpha(1))∗ones(1,M);
% epsilon and half-power frequency
epsi = sqrt(10ˆ(0.1∗alphamax)-1);
whp = 2∗atan(tan(0.5∗wp)∗cosh(acosh(sqrt(10ˆ(0.1∗3.01)-1)/epsi)/N));
whp = whp/pi
% plotting
subplot(221); zplane(b,a)
subplot(222)
plot(w,abs(H)); grid; axis([0 max(w) 0 1.1∗max(abs(H))])
subplot(223)
plot(w,unwrap(angle(H)));grid;
subplot(224)
plot(w,alpha);
hold on; plot(w,spec0,‘r’); hold on; plot(w,spec1,‘r’)
hold on; plot(w,hpf,‘k’); hold on
plot(w,spec2,‘r’); grid; axis([0 max(w) 1.1∗min(alpha) 1.1∗(alpha(1) + 3)]);
hold off
figure(2)
end
The transfer function of the first filter is
H 1 (z)=
0.224+0.449z−^1 +0.224z−^2
1 −0.264z−^1 +0.394z−^2
and its half-power frequency isωhp=0.493πrad. The second-order filter has a transfer function of
H 2 (z)=
0.094+0.283z−^1 +0.283z−^2 +0.094z−^3
1 −0.691z−^1 +0.774z−^2 −0.327z−^3
and a half-power frequency ofωhp=0.4902π. The poles and the zeros as well as the magnitude
and the phase responses of the two filters are shown in Figure 11.16. Notice the difference in the
gain (or losses) in the passband of the two filters. In order for the dc gain to be unity, the gain in
the even-order filter reaches values above 1, while the odd-order filter does the opposite.
The cut-off frequency given as output bycheb1ordand thatcheby1uses isωp. Since the half power is
not given bycheb1ord, the half-power frequency of the filter is calculated using the minimal order
N, the ripple factorε, and the passband frequencyωpin Equation (11.37). See the script. n
nExample 11.10
Consider the following specifications of a filter that will be used to filter an acoustic signal:
dc gain= 10
Half-power frequency:fhp=4 KHz
Band-stop frequency:fst=5 Khz,αmin=60 dB
Sampling frequency:fs=20 KHz