NAIVE DESIGN METHOD
7.4.1 NAIVE DESIGN METHOD
In this method we set H(k) = H d (e j2πk/M ), k = 0, . . . , M − 1 and use (7.35) through (7.39) to obtain the impulse response h(n).
! EXAMPLE 7.14 Consider the lowpass filter specifications from Example 7.8.
ω p = 0.2π, R p = 0.25 dB ω s = 0.3π, A s = 50 dB
Design an FIR filter using the frequency sampling approach.
Solution Let us choose M = 20 so that we have a frequency sample at ω p , that is, at k = 2:
p = 0.2π =
20 and the next sample at ω s , that is, at k = 3:
Thus we have 3 samples in the passband [0 ≤ ω ≤ ω p ] and 7 samples in the stopband [ω s ≤ω≤π ]. From (7.36) we have
Since M = 20, α = 20−1 2 = 9.5 and since this is a Type-2 linear-phase filter,
from (7.37) we have
− 9.5 k = −0.95πk, 0 ≤ k ≤ 9
H (k) =
20 ⎩ +0.95π (20 − k) ,
10 ≤ k ≤ 19 Now from (7.35) we assemble H (k) and from (7.39) determine the impulse
response h (n). The MATLAB script follows: >> M = 20; alpha = (M-1)/2; l = 0:M-1; wl = (2*pi/M)*l;
>> Hrs = [1,1,1,zeros(1,15),1,1]; %Ideal Amp Res sampled >> Hdr = [1,1,0,0]; wdl = [0,0.25,0.25,1]; %Ideal Amp Res for plotting >> k1 = 0:floor((M-1)/2); k2 = floor((M-1)/2)+1:M-1; >> angH = [-alpha*(2*pi)/M*k1, alpha*(2*pi)/M*(M-k2)]; >> H = Hrs.*exp(j*angH);
h = real(ifft(H,M));
>> [db,mag,pha,grd,w] = freqz_m(h,1); [Hr,ww,a,L] = Hr_Type2(h); >> subplot(2,2,1);plot(wl(1:11)/pi,Hrs(1:11),’o’,wdl,Hdr); >> axis([0,1,-0.1,1.1]); title(’Frequency Samples: M=20’) >> xlabel(’frequency in pi units’); ylabel(’Hr(k)’)
Chapter 7
FIR FILTER DESIGN
Frequency Samples: M=20
Impulse Response
Hr(k)
h(n) 0.1
frequency in π units
Amplitude Response
Magnitude Response
Hr(w)
frequency in π units
frequency in π units
FIGURE 7.26 Naive frequency sampling design method
>> subplot(2,2,2); stem(l,h); axis([-1,M,-0.1,0.3]) >> title(’Impulse Response’); xlabel(’n’); ylabel(’h(n)’); >> subplot(2,2,3); plot(ww/pi,Hr,wl(1:11)/pi,Hrs(1:11),’o’); >> axis([0,1,-0.2,1.2]); title(’Amplitude Response’) >> xlabel(’frequency in pi units’); ylabel(’Hr(w)’) >> subplot(2,2,4);plot(w/pi,db); axis([0,1,-60,10]); grid >> title(’Magnitude Response’); xlabel(’frequency in pi units’); >> ylabel(’Decibels’);
The time- and the frequency-domain plots are shown in Figure 7.26. Observe that the minimum stopband attenuation is about 16 dB, which is clearly unac- ceptable. If we increase M , then there will be samples in the transition band, for which we do not precisely know the frequency response. Therefore the naive design method is seldom used in practice.
7.4.2 OPTIMUM DESIGN METHOD To obtain more attenuation, we will have to increase M and make the transition band samples free samples—that is, we vary their values to obtain the largest attenuation for the given M and the transition width.
Frequency Sampling Design Techniques 349
This problem is known as an optimization problem, and it is solved using linear programming techniques. We demonstrate the effect of transition band sample variation on the design using the following example.
! EXAMPLE 7.15 Using the optimum design method, design a better lowpass filter of Example 7.14.
Solution Let us choose M = 40 so that we have one sample in the transition band 0.2π < ω < 0.3π. Since ω △
1 = 2π/40, the transition band samples are at k = 5 and at k = 40 − 5 = 35. Let us denote the value of these samples by T 1 ,
0<T 1 < 1; then the sampled amplitude response is H r (k) = [1, 1, 1, 1, 1, T 1 , 0, . . . , 0 ,T 1 , 1, 1, 1, 1]