Unit - 5
FIR Filter Design
Q1) Design a LPF using rectangular window for the desired frequency response of a low pass filter given by ωc = π/2 rad/sec, and take M=11. Find the values of h(n). Also plot the magnitude response.
A1)
r= M-1/2 = 5
By taking inverse Fourier transform
For and
For Using L’Hospital Rule
Where
The given window is rectangular window ω(n) = 1 for 0 ≤ n ≤ 10
=0 Otherwise
This is rectangular window of length M=11. h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 10
H[z]= =
The impulse response is symmetric with M=odd=11
Response
Q2) The desired frequency response of low pass filter is given by Hd (ejω) = e−j3ω − 3π/ 4 ≤ ω ≤ 3π/ 4 and 0 for 3π /4 ≤ |ω| ≤ π Determine the frequency response of the FIR if Hamming window is used with N=7
A2)
t = M-1/2 = 3
For and
For Using L’Hospital Rule
Where
The given window is hamming window
To calculate the value of h(n)
The frequency response is symmetric with M=odd=7
RESPONSE
Q3) Design the FIR filter using Hanning window
A3)
To calculate the value of
Q4) Design an FIR filter (lowpass) using rectangular window with passband gain of 0 dB, cut-off frequency of 200 Hz, sampling frequency of 1 kHz. Assume the length of the impulse response as 7.
A4)
When
When
Calculating h(n)
As it is rectangular window h(n) = w(n)=hd(n)=h(n)
For M=7
n | |
0 | -0.062341 |
1 | 0.093511 |
2 | 0.302609 |
3 | 0.4 |
4 | -0.062341 |
5 | 0.093511 |
6 | 0.302609 |
Q5) Using rectangular window design a lowpass filter with passband gain of unity, cut-off frequency of 1000 Hz, sampling frequency of 5 kHz. The length of the impulse response should be 7.
A5)
The filter specifications (ωc and M=7) are similar to the previous example. Hence same filter coefficients are obtained.
h (0) =-0.062341, h(1)=0.093511, h(2)=0.302609 h(3)=0.4, h(4)=0.302609, h(5)=0.093511, h(6)=-0.062341
Q6) Design a HPF using Hamming window. Given that cut-off frequency the filter coefficients hd (n) for the desired frequency response of a low pass filter given by ωc = 1rad/sec, and take M=7. Also plot the magnitude response.
A6)
By taking inverse Fourier transform
The given window function is Hamming window. In this case
for
0 | -0.00119 |
1 | -0.00448 |
2 | -0.2062 |
3 | 0.6816 |
4 | -0.00119 |
5 | -0.00448 |
6 | -0.2062 |
The magnitude response of a symmetric FIR filter with is
For M=7
Q7) Design an ideal bandpass filter having frequency response Hde (jω) for π/ 4 ≤ |ω| ≤ 3π/ 4. Use rectangular window with N=11 in your design.
A7)
The length of the filter with given is related by
And
The given window is rectangular hence
For n=0,1,2,…,10 estimate the FIR filter coefficients h(n).
Q8) Draw using the cascade form for the LTI system whose transfer function is
A8) Hence H(z) can be factorized as
Although it can be realized with first-order sections, complex coefficients are needed, which implies higher computational cost. To guarantee real-valued coefficients, we group the sections of complex conjugates together.
Q9) State and explain Gibb’s phenomenon.
A9) In practice it may be impossible to use all the terms of a Fourier series. For example, suppose we have a device that manipulates a periodic signal by first finding the Fourier series of the signal, then manipulating the sinusoidal components, and, finally, reconstructing the signal by adding up the modified Fourier series. Such a device will only be able to use a finite number of terms of the series.
Gibbs’ phenomenon occurs near a jump discontinuity in the signal. It says that no matter how many terms you include in your Fourier series there will always be an error in the form of an overshoot near the discontinuity.
The overshoot always be about 9% of the size of the jump. We illustrate with the example. Of the square wave sq(t). The Fourier series of sq(t) fits it well at points of continuity. But there is always an overshoot of about .18 (9% of the jump of 2) near the points of discontinuity.
In these figures, for example, ’max n=9’ means we we included the terms for n = 1, 3, 5, 7 and 9 in the Fourier sum
Q10) Design an FIR lowpass using the windowing method such that
A10) From the window characteristic we immediately see that for Hammering window will work.
To find M set
The cut-off frequency is
If a Kaiser window is desired, then for choose
The prescribed value for M should be
Assume that we need to implement the nine-tap FIR filter given by the following table using a cascade structure.
k | 4 | 3 and 5 | 2 and 6 | 1 and 7 | 0 and 8 |
0.3333 | 0.2813 | 0.1497 | 0 | -0.0977 |
Sol:
The system function of this filter is
It can be show
Where
Q11) Design a high-pass filter with fs=200Hz and fp=300Hz which exhibits attenuation greater than 40dB in the stop-band. We need the pass-band ripple to be less than 0.2dB. Assume that the sampling frequency, fsamp, is 1200Hz.
A11)
We can find the pass-band ripple as 20log(1+δ1)−20log(1)=20log(1+δ1). In this example, 20log(1+δ1)=0.2dB, hence δ1=0.023.
The stop-band attenuation is −20log(δ2)=40dB which gives δ2 =0.01.
To find the angular frequencies, we need to normalize fs and fp with half the sampling frequency and multiply the result by π. Therefore, ωp=2πfp/ fsamp =0.5π and ωs = 0.33 π
Equating the transition band, 0.17π, with the main lobe width of the Hann window, we obtain M=47. An odd M will lead to a type II filter which is not suitable for high-pass and band-stop filters. As a result, we need to increase the filter length by one, i.e. M=48.
Using the equation describing a Hanning window, we find the window as
Q12) Calculate the filter coefficients for a 3-tap FIR lowpass filter with a cutoff frequency of 800 Hz and a sampling rate of 8,000 Hz using Hamming window
b) Determine the transfer function and difference equation of the designed FIR system.
c) plot the magnitude frequency response.
A12)
The coefficients of the lowpass filter is c 2f cTs 2 800 / 8000 0.2
h0 0.2, h(1) h(1) 0.1871
For Hamming window with M = 3
w(n) 0.54 0.46 cosn w0 0.2, w(1) w(2) 0.01497 and for n = 0 ,1, 2 Then the windowed impulse response coefficients are h 0 1, h(1) h(2) 0.08
Convert to z-domain
H(z) = 0.1497 + 0.2z-1 +0.1497z-2
Then the difference equation is
y(n) 0.01497x(n) 0.2x(n 1) 0.01497x(n 2).
Q13) A Digital Filter has frequency response () such that
Also let the sampling frequency be Fs 8 kHz. Determine the Passband and Stopband frequencies in kHz, the Passband ripple and the Stopband attenuation in dB.
A13)
The passband ripple is given by 20 log10 1.05 0.42 dB, and the attenuation in the stopband 20 log10 0.005 46 dB.
The analog passband frequency is 0.3 Fs / 2 1.2 kHz and the stopband 0.4 Fs / 2 1.6 kHz
Q14) Design a low pass filter with passband Fp 2 kHz and stopband FS 2.5 kHz, with attenuation of at least 40dB. Let the sampling frequency be Fs 10 kHz. Using the techniques you know, determine the design with the least number of coefficients.
A14)
First we translate the specifications into the digital frequency domain:
Pass band
Stop band
We know three techniques: (a) Window based: from the desired attenuation we need hamming window. From the transition region
We obtain the length of the filter N=81;
b) Kaiser window: applying the formulas with A=40 and =0.1π we obtain
c) Equi ripple filter: using the matlab function “remezord” we obtain the order N=39 which yields the lowest complexity. The corresponding frequency response is shown below (magnitude only in dB’s).
Q15) Write the steps to design a LPF.
A15)
- Choose the window function , that meets the stopband requirements as given in the table above.
- Choose the filter length M,(actual length is M +1)such that
- Choose in the truncated impulse response such that
- Plot to see if the specifications are satisfied.
- Adjust and M if necessary to meet the requirements. If possible reduce M.
Q16) Compare all the windowing techniques?
A16)
Window name
| Window function |
Rectangular | |
Triangular
| |
Hamming | |
Hanning | |
Blackman |
Window name | Transition width of main lobe | Min. Stopband attenuation | Peak value of side lobe |
Rectangular | -21dB | -21dB | |
Hanning | -44dB | -31dB | |
Hamming | -53dB | -41Db | |
Barlett | -25dB | -25Db | |
Blackman | -74dB | -57Db |
Q17) Explain magnitude and phase response of FIR filters?
A17)
Frequency response of digital filter:
Continuous function of θ with period 2π
- is the called the Magnitude function.
Magnitude functions are even functions
- is called the Phase lag angle
Phase functions are odd functions
- More convenient to use the magnitude squared and group delay functions than and
- Magnitude squared function:
- It is assumed that H(z) has real coefficients only.
- Group delay function (θ). Measure of the delay of the filter response.
Complex zeros and poles occur in conjugate pairs.
If is a real zero/pole of is also a real zero/pole.
If is a zero/pole of are also zeros/poles.
Magnitude and Phase Characteristics
Q18) Explain frequency sampling structure?
A18) The frequency sampling method allows the use of recursive implementation of FIR Filter. There are two ways for frequency sampling
Non-Recursive frequency sampling filter
If the frequency shown below are sampled in the interval 0 to N-1 where N-1 is number of sampling. Sampling interval is Kfs/N, 0≤k≤N-1.
Fig: Frequency Sampling
The FIR coefficient h[n] is calculated by IDFT of frequency samples.
h[n] = 0≤k≤N-1.
=
=
h[n] =
α = [N-1]/2
For N=odd, summation limit will be [N-1]/2
Recursive frequency sampling filter
The recursive force of frequency sampling filter offers significant computational advantages over non recursive form if large number of frequency samples are zero valued. The transfer function of an FIR filter H[z] should be in recursive form. Impulse response of filter may be defined in terms of frequency samples.
h[n]=
H[z]=
Substituting value of h[n] and inter changing summation we have
H[z] = ]
H[z] can be represented as H[z] =H1[z]H2[z]
H1[z]=
H2[z] = ]
Expanding above terms and solving them we finally get
H[z] = H1[z]H2[z]
H[z] =[
For frequency response we can replace z=ejωTs
H[ωn] = H[k] 0≤k≤N-1.
Q19) Define phase and group delay for linear phase filter?
A19) Consider a signal that consists of several frequency components passing through a filter.
The phase delay (Tp) of the filter is the amount of time delay each frequency component of the signal suffers in going through the filter.
The group delay (Tg) is the average time delay the composite signal suffers at each frequency.
Where Θ(w) is the phase angle
A filter is said to have a linear phase response if,
Where α and are constants
For Example
For ideal LPF
Q20) Explain the symmetric impulse response of FIR filters?
A20)
Phase response
Follows: Linear phase implies that the output is a replica of x[n] {LPF} with a time shift of .
Symmetric impulse response will yield near phase FIR filters.
Positive symmetry of impulse response
n=0,1,…,(N-1)/2 (N odd)
N=0,1,…(N/2)-1 (N even)
Negative symmetry of impulse response:
n=0,1,…,(N-1)/2 (N odd)
n=0,1,…(N/2)-1 (N even)