the iir filters these are highly sensitive to coefficients which may affect stability. the...
DESCRIPTION
Advantages of FIR filters Any arbitrary magnitude response can be designed using frequency sampling technique. They are inherently stable. It is the first choice of the designer if the time delay is not important, even though components required are many more times. …..contdTRANSCRIPT
The IIR FILTERsThese are highly sensitive to coefficients
which may affect stability. The magnitude-frequency response of these
filters is established while the phase-frequency response is poor. These filters have short time delay
and better time response.
The FIR filters FIR have truncated time-response. Thus their frequency response is poor. These can be designed for time-limited
as well as frequency-limited response.
FIR filters are inherently stable. Can be designed for Linear phase
performance. …..contd
Advantages of FIR filters
Any arbitrary magnitude response can be designed using frequency sampling technique. They are inherently stable.It is the first choice of the designer if the time delay is not important, even though components required are many more times.
…..contd
Properties of FIR filters….It is simple to implementation.
• The finite word length effect is far less severe on frequency performance.
• Non-causal filters can be designed for the use of mathematical manipulations.• To reduce the computation time of
convolution the long discrete sequences, FFT algorithms are used.
Properties of FIR filters…. FFT can be implemented on hardware as well as on soft-ware. FIR filter are implemented non-recursively. But these can be mathematically expressed recursively. It has no support of analog filters.Computer Aided Designs are used to design such filters.
Comparison between IIR and FIR
by example 10.01.The following transfer functions, one is recursive and other is non-recursive. Both yield identical
magnitude-frequency response. We Compare their computational and storage
requirements. Recursive Transfer function
H1(z) = (bo+ b1 z-1 + b2 z-2) / (1+a1 z-1 + a 2 z-2)where
[bo b1 b2] = [ 0.4981819 0.9274777 0.4981819] [a1 a2] =[ -0.6744878 - 0.3633482]
and
Example 10.01 contd…Non recursive transfer function:
whereh(0) = h(11) = 0.54603280 x 10-2
h(1) = h(10) = -0.45068750 x 10-1
h(2) = h(9) = 0.69169420 x 10-1
h(3) = h(8) = -0.55384370 x 10-1
h(4) = h(7) = -0.63428410 x 10-1
h(5) = h(6) = 0.57892400 x 100
H2 z( )
0
11
k
h k( ) z k
=
Summary:Computational and storage requirements
Thus we see that IIR filter requires far less components and storage space. But since FIR
filter coefficients are symmetrical, the later results in efficient implementation.
item IIR filter H1 (z)
FIR filter H2 (z)
Number of multiplication 5 12Storage elements 2 11Storage locations, coefficients
7 23
Linear Phase response FIR:Tptime-phase delay and Tg time group delay.Phase Delay:
A signal consists of several frequency components.
The phase delay is the amount of time delay each individual frequency components of the
signal suffer while transmitted through a system. Non linear phase characteristics of a system
results in phase distortion at the output due to alteration in the phase relationship of frequency
components of the signal during processing.
Phase delay contd. Non linear phase delay is undesirable in
hi-fi systems such as video-,bio-, data- transmission etc.
Mathematical model of phase delay is:Tp = - ()/
For linear phase response, the following conditions should be satisfied:
where and are constants.
In the expression For a filter of length N,
If the symmetry is positive, = 0 and = (N -1)/2;
and if the symmetry is negative, = /2 and = (N -2)/2).
[Ifeachor,”Digital Signal Procesing”2/e, PH,pp344-348]
Group Delay It is the average time delay of the frequency components of the
composite signal. Mathematically it is defined as:
Tg = -d()/d =
“the derivative of phase wrt frequency”. For no phase distortion, the should
be a constant.
Phase delay and Group Delay
• Phase • Phase delay Tp = - ()/• Group delay Tg = -d()/d= • The phase delay = group delay
if / is a constant.
Phase and Group Delays Phase and Group Delays displayeddisplayed• Figure below shows the waveform of an
amplitude-modulated input and the output generated by an LTI system
phase
Phase and Group DelaysPhase and Group Delays• Note: • The carrier component at the output is delayed
by the phase delay.• the envelope of the output is delayed by the
group delay.• It is relative to the waveform of the underlying
continuous-time input signal• The waveform at the output shows distortion if
the group delay is not constant.
Phase and Group DelaysPhase and Group Delays
• If the distortion is unacceptable then a delay equalizer is cascaded to enable the overall group delay nearly linear over the frequency band of interest
• To keep the magnitude response of the parent system unchanged, the magnitude characteristics of delay equalizer need to be constant over the frequency band of interest.
Necessary and sufficient condition for a
linear phase response filter is: The transfer function of the filter
should be symmetrical. This symmetry can be positive or, negative.
The word-length N, can be even or, odd.
It returns four cases:
Two cases for odd word-lengthOdd coefficients: ao= h[(N-1)/2]; a(n) = 2h[(N-1)/2 - n]
Case Wordlength
Symmetry response
I odd EvenOr,Positive
II odd Odd, Or,Negative
e
j N 1( )2
0
N 12
n
a n( )
=
cos n( )
ej
N 1( )2
2
0
N 12
n
a n( ) sin
=
n( )
Two cases for even word-lengthEven coefficients: b(n) = 2h(N/2 – n)
case Wordlength
symmetry response
III Even Even,Or,Positive
IV Even Odd,Or,Negative
ej
N 1( )2
2
1
N2
n
b n( ) sin
=
n 12
e
j N 1( )2
1
N2
n
b n( ) cos
=
n 12
Even image symmetry with odd and even word length.
e
j N 1( )2
0
N 12
n
a n( )
=
cos n( ) e
j N 1( )2
1
N2
n
b n( ) cos
=
n 12
1st 3rd
FD=1/2
Conclusion…1 Even length filter (IV) always exhibit zero response at FD= 0.5. FD= 0.5 corresponds to half the sampling frequency.
Hence it is not suitable for high pass filters.It has zero response at DC too.
Negative symmetry filters (II & IV) introduces a phase shift of in the phase response. It makes output zero at DC or, zero frequency. not suitable for low pass filters. These are useful in design of differentiator and Hilbert transformers as they require radians phase shift.
Conclusion….2
Type I is
the most versatile
filter.
Conclusion….3• Further note that the phase delay for positive
symmetry (I and III) or group delay in all the four filters is expressible in terms of the coefficients of the word length of the filter.
• And hence can be corrected to give a zero phase or, group delay response.
• Denoting T to be the sampling period, phase delay Tp For filter I and III, = (N-1)T/2;For filter II and IV, = (N – 1 - )T/2.
[Ifeachor,”Digital Signal Processing” PH, 2/e, pp.344-348.
Summery: configuration & standard filters
I II III IV
LP
BP
HP
BS
STEPS IN FIR FILTER DESIGN 1. Filter Specifications:
• Filter transfer function H(z), • Required amplitude and phase responses,
• acceptable tolerances, • sampling frequency and
• the word length of the input data. 2. Coefficient Calculations:
to determine the coefficients of H(z) so as to satisfy the filter specifications.
STEPS IN FIR FILTER DESIGN….3. Realization:
Conversion of the transfer function into suitable structure.
4. Analysis of finite word length effects: Error effect of quantization of input signal,
Effect of coefficient quantization. Optimization of word-length.
5. Implementation: Producing software codes and/or hardware
and performing the actual filtering.
Design specifications1. Pass / Stop band specifications:Magnitude deviation (includes ripple)
Pass/Stop band edge frequency (or frequencies in case of band
pass/stop filter).2. Sampling Frequency.
3. Word length of the filter
Methods of Calculation of FIR Coefficients
1. The Window Method,2. Frequency Sampling Method,
3. Optimal or, Min-max design method. Each method can lead to design of a linear phase FIR filter.
The common mathematical model is:
H z( )
0
n
k
h k( ) z k
=
The window methodA suitable window function w[n] is
selected, required word length is calculated.
Then it is multiplied with the impulse response of a (ideal) LPF. Thus
hw [n] = h[n] w[n]
Or, hw [n] = H[F] W[F].
The window method….• The spectrum of ideal low pass filter
have a jump discontinuity at F = Fc. • But the windowed spectrum shows
over-shoot, ripple and
a finite transition width but
no abrupt jump.
Window method contd… It’s normalized signal magnitude at
F = Fc is 0.5. It corresponds to attenuation of -6 dB. The ripple in pass band and over-shoot is
attributed to Gibb’s phenomena; 9% minimum.
The side-lobs produces the ripple in pass band and stop band.
The ripples in pass band and stop band have odd symmetry.
Window method contd…The transition width is due to main lob. Wider the main lob, wider is the transit band. Wider is the window width, smaller is the width of main-lob.Number of minima and maxima in the pass band and stop band are decided by N.Unlike in Tchebyshev Filters, the peaks here have different heights, maximum near band edges, decaying thereafter.
Note that number of samples equal maxima and minima of a rectangular window in pass- and stop band.
The peak occurs near band edges.Maxima-Minima
Rectangular WindowThis window has two properties: maximum number of alternating maxima and minima and their peaks follow the attenuation at the
rate of –6.02dB per octave or, equivalent -20dB/dec.
Mathematical model of different type windows follows.
Mathematic Models Of Different Type Of Windows
Window Representation ExpressionRectangular wR[n] 1Bartlett wT[n] 1 – {2|n| / (N-1)}Von Hann whn [n] 0.50 + 0.50 cos{2n/(N-1)}Hamming whm [n] 0.54 + 0.46 cos{2n/(N-1)}Blackman wb [n] 0.42 +0.50 cos{2n/(N-1)}
+0.08 cos{4n/(N-1)}Kaiser wK[n,] Io(x1)/Io(x2);
ratio of modified bessel function of order zero; where
x1=( {1 – 4[n/(N-1)]2}); and x2= ()
Characteristics of Windows
We now examine the characteristics of various other type of windows and compare their performances for N=21and N=51.
Before that note various nomeclatures.
Mathematical representation:Nomenclatures
1. GP / GS = Peak Gain of main-lob / side-lobe dB
2. ASL = Side-lobe attenuation = (GP /GS) dB. 3. WM = Half-width of main-lobe
4. W6 / W3 = - 6 dB / -3dB half-width
5. DS = stop-band attenuation dB/dec.
6. FWS = C/N where C= constant of filter.7. WS = Half width in main-lobe to reach the peak
level of first side lob.8. Aws= Peak side-lobe attenuation in dB
9. AWP = Pass band attenuation in dB
Window Gp GS/Gp ASLdB WM WS W 6 W3 DS AWS FWS AWP
Rectangular 1 0.2172 13.3 1 0.81 0.6 0.44 20 21.7 0.92 1.562
BartlettTriangular
0.5 0.0472 26.5 2 1.62 0.88 0.63 40 25
Von HannHanning
0.5 0.0267 31.5 2 1.87 1.0 0.72 60 44 3.21 0.1103
Hamming 0.54 0.0073 42.7 2 1.91 0.9 0.65 20 53 3.47 0.0384
Blackman 0.42 0.0012 58.1 3 2.82 1.14 0.82 60 75.3 5.71 0.003
Kaiser = 0.26
0.4314 0.0010 60 2.98 2.72 1.11 0.80 20
Note: The widths; WM, WS, W6, W3; must be normalized by the window length N.Empirical Values for Kaiser Window depends on the value of defined as:
GP = |sinc(j)| / Io(); ASL = Sinh()/0.22; WM = (1+2); W 6 = (0.661+2)
PROCEDURE OF CALCULATING FILTER COEFFICIENTS USING WINDOW
Specify the desired frequency response of the filter Hd().
Obtain the impulse response hD [n] of the desired filter by inverse Fourier transform. Select a window which satisfies the pass-band attenuation specification.
PROCEDURE OF CALCULATING FILTER COEFFICIENTS USING WINDOW…Determine the number of coefficients
using the appropriate relationship between the filter length and the transition width f expressed as a fraction of the sampling frequency. Obtain the values of w[n] for the chosen window function and that of the actual FIR coefficients h[n] and multiplying them. Plot the response and verify the compliance of specifications.
Summery of ideal impulse response of standard frequency selective
filtersFilter type Ideal impulse response
hD[n]HD [0]
Low Pass 2fcsinc(nc) 2fc
High Pass 1-2fcsinc(nc) 1-2fc
Band Pass 2f2sinc(n2)- 2f1sinc(n1) 2(f2-f1)
Band Stop 2f1sinc(n1)- 2f2 sinc(n2) 1-2(f2-f1)
Note: fc, f1 and f2 are the normalized edge frequencies. N is the length of the filter [Ifeachor: p.353]
Remarks:
• The TF of a filter is an even symmetric function.• It is an ideal transfer function.• It has a linear phase response.• Theoretical value of n . But for an FIR filter, n should be finite.• With finite n, the response will have ripples.• The response will also have at least 9% overs-
hoots near critical frequencies, Gibbs Phenomena.
Remarks: If the n in truncated range is increased, ripple
is reduced so also the overshoot, upto 9%. Increased n means increase in number of
coefficients. Ideal truncation is equivalent to convolving
an ideal filter hD having frequency response sinc() with rectangular frequency window, W().
It is equivalent to multiplication in time domain.
convolution of an ideal filter with a sinc window function.
Peak side lob attenuation
Window Gp GS/Gp ASLdB WM WS W 6 W3 DS AWS FWS AWP
Rectangular 1 0.2172 13.3 1 0.81 0.6 0.44 20 21.7 0.92 1.562
BartlettTriangular
0.5 0.0472 26.5 2 1.62 0.88 0.63 40 25
Von HannHanning
0.5 0.0267 31.5 2 1.87 1.0 0.72 60 44 3.21 0.1103
Hamming 0.54 0.0073 42.7 2 1.91 0.9 0.65 20 53 3.47 0.0384
Blackman 0.42 0.0012 58.1 3 2.82 1.14 0.82 60 75.3 5.71 0.003
Kaiser = 0.26
0.4314 0.0010 60 2.98 2.72 1.11 0.80 20
Note: All widths; WM, WS, W6, W3; must be normalized by the window length N.Empirical Values for Kaiser Window depends on the value of defined as:
GP = |sinc(j)| / Io(); ASL = Sinh()/0.22; WM = (1+2); W 6 = (0.661+2)
Example:Design a low-pass FIR filter to meet the following specs:Pass band edge frequency: 1500 HzTransition width: 500 Hz.Stop-band attenuation AWS= > 50 dBSampling frequency fs = 8000 Hz.
Soln:1. Meaning of given specifications are:
Sampling frequency fs = 8000 Hz.
Pass band edge frequency: fc =1500/8000
Transition width f = 500/8000.Stop-band attenuation AWS= > 50 dB
Design considerations contd…
2. The filter function is HD ()= 2fc sinc(nc).
3. Because of stop-band attenuation characteristics, either of the Hamming,
Blackman or,Kaiser windows
can be used. We use Hamming window:
whm[n] =0.54 + 0.46 cos{2n/(N-1)}
Design considerations contd…4 f = transition band width/sampling frequency
= 0.5/8 =0.0625 = 3.3/N.Thus N = 52.8 53 i.e. for symmetrical window
–26 n 26.
fc’ = fc + f/2 = (1500+ 250)/8000 = 0.21875.5. Calculate values of hD [n] and whm[n] for
–26 n 26 Add 26 to each index so that the indices range
from 0 to 52.6. Plot the response of the design and verify the
specifications.
Calculations:c= 2fc = 1.37452fc=1.3745/ = 0.4375 • hD(n) = 2fc [sin(nc)/ nc]
wn = [0.54 + 0.46cos(2n/N) The input signal to the filter function is a series of
pulses of known width but of different heights manipulated as per the window function.
• The overall is the multiplication of two.
Calculations…
h(n) = hD [n] w D[n] = 0.4375 {[sin(nc)/ nc]}
x {[0.54 + 0.46cos(2n/N)}at n=0, sincesin(nc)/nc = 1, so also cos(0) = 1; h(0) = 0.4375 x[0.54 + 0.46] = 0.4375.Again since 2fc / c = 1/h(n)= [sin(1.3745n)/n] [0.54 +0.46cos(2n/53)]
Coefficient Calculationsn 1 26 hnsin 1.3745n( )
n wn 0.54 0.46( )cos 2
n53
hn
0.3120.061-0.088-0.0560.0350.049
-3-8.888·10-0.04
-3-6.883·100.0290.016-0.019-0.02
-38.716·100.021
-5-1.694·10-0.018
-3-6.752·100.0140.011
-3-8.435·10-0.013
-32.717·100.013
-32.467·10-0.011
wn
0.9930.9720.9370.89
0.8290.7580.6750.5830.4830.3760.2640.1480.03
-0.089-0.206-0.32-0.43
-0.534-0.63
-0.718-0.795-0.861-0.915-0.956-0.984-0.998
hn wn
0.310.059-0.083-0.050.0290.037
-3-5.999·10-0.023
-3-3.323·100.011
-34.234·10-3-2.771·10-4-6.03·10-4-7.74·10-3-4.286·10-65.425·10-37.899·10-33.604·10-3-8.783·10-3-8.066·10-36.705·10
0.012-3-2.486·10
-0.013-3-2.428·10
0.011
n
123456789
1011121314151617181920212223242526
Example:Design a filter for the specifications:Pass band: 150-250 Hz.Transition width: 50 HzPass band ripple: 0.1 dB max.Stop-band attenuation: > 60 dBSampling frequency: 1000 Hz.
Soln: The above is a band pass filter.
1. Interpretations of specifications are:Sampling frequency fs = 1000 Hz.Pass band edge frequency: fc = 150-
250/1000Pass band ripple: p= 0.1 dB max.Transition width f = 50/1000.Stop-band attenuation AWS= > 60 dB
Design considerations contd…2. The filter function is
HD()= 2f2 sinc(n2) -2f1 sinc(n1)
3. Because of stop-band attenuation characteristics, either of the Blackman or, Kaiser windows can be used.
4. From the specifications of pass band and stop-band:20 log(1+p) = 0.1 or, p = 0.0115;
-20 log (s) = 60 dB, or, s = 0.001.
therefore = min(p, s) = 0.001.
Window Gp GS/Gp ASLdB WM WS W 6 W3 DS AWS FWS AWP
Rectangular 1 0.2172 13.3 1 0.81 0.6 0.44 20 21.7 0.92 1.562
BartlettTriangular
0.5 0.0472 26.5 2 1.62 0.88 0.63 40 25
Von HannHanning
0.5 0.0267 31.5 2 1.87 1.0 0.72 60 44 3.21 0.1103
Hamming 0.54 0.0073 42.7 2 1.91 0.9 0.65 20 53 3.47 0.0384
Blackman 0.42 0.0012 58.1 3 2.82 1.14 0.82 60 75.3 5.71 0.003
Kaiser = 0.26
0.4314 0.0010 60 2.98 2.72 1.11 0.80 20
Note: All widths; WM, WS, W6, W3; must be normalized by the window length N.Empirical Values for Kaiser Window depends on the value of defined as:
GP = |sinc(j)| / Io(); ASL = Sinh()/0.22; WM = (1+2); W 6 = (0.661+2)
Design considerations contd…5. We use Blackman window:
wb[n] = 0.42 +0.50 cos{2n/(N-1)}
+ 0.08 cos{4n/(N-1)}f = transition band width/sampling frequency = 50/1000 =0.05 = 5.5/N.hence N 110. i.e. for symmetrical even window
–55 n 55, but for n=0., being an even window. We can choose N = 111.
Design considerations contd…
6. For N =111,Plot the response of the design and verify the specifications.
7. Calculate values of hD [n] and whm [n] for –55 n 55
8. Add 55 to each index so that the indices range from 0 to111.
Comparison of commonly used windows with Kaiser window:
Window type
Peak normalized side lob amplitude
Approximate. Width of main-lob
Appx. peak error 20 log
Equivalent Kaiser Window Transition Width
Rectangular -13 4/(M+1) -21 0 1.81/M
Bartlett -25 8/M -25 1.33 2/37/M
Hanning -31 8/M -44 3.86 5.01/M
Hamming -41 8/M -53 4.86 6/27/M
Blackman -57 12/M -74 7.04 9.19/M
The comparison shows that the Kaiser window is more efficient than any other window in question.
Example: take-up above problem and solve it using Kaiser window.
Soln.specifications are repeated here:Sampling frequency fs = 1000 Hz.Pass band edge frequency: fc = 150-
250/1000Pass band ripple: p= 0.1 dB max.Transition width f = 50/1000.Stop-band attenuation AWS= > 60 dB
Window Gp GS/Gp ASLdB WM WS W 6 W3 DS AWS FWS AWP
Rectangular 1 0.2172 13.3 1 0.81 0.6 0.44 20 21.7 0.92 1.562
BartlettTriangular
0.5 0.0472 26.5 2 1.62 0.88 0.63 40
Von HannHanning
0.5 0.0267 31.5 2 1.87 1.0 0.72 60 44 3.21 0.1103
Hamming 0.54 0.0073 42.7 2 1.91 0.9 0.65 20 53 3.47 0.0384
Blackman 0.42 0.0012 58.1 3 2.82 1.14 0.82 60 75.3 5.71 0.003
Kaiser = 0.26
0.4314 0.0010 60 2.98 2.72 1.11 0.80 20
Note: All widths; WM, WS, W6, W3; must be normalized by the window length N.Empirical Values for Kaiser Window depends on the value of defined as:
GP = |sinc(j)| / Io(); ASL = Sinh()/0.22; WM = (1+2); W 6 = (0.661+2)
Design using Kaiser WindowThe filter function is
HD()= 2f2 sinc(n2) -2f1sinc(n1)Because of stop-band attenuation characteristics, either of the Blackman or, Kaiser windows can be used.From the specifications of pass band and stop-band: 20 log(1+p) = 0.1 dB or, p = 0.0115;-20 log (s) = 60 dB, or, s = 0.001.therefore = min(p, s) = 0.001.f = transition band width/sampling frequency = 50/1
=0.05= (AWS-7.95)/ 14.36N = (60-7.95)/14.36N or, N =72.49 73.
..contd
Design using Kaiser Window…
Calculation of by empirical formulae. = 0 if A 21 dB; = 0.5842(AWS -21)0.4 + 0.07886(A-21)
if A <21<50 dB = 0.1102(AWS -8.7) if A 50
Hence = 5.65Evaluate the coefficients.
Evaluate the performance. plot the graph and verify the performance of
designed filter.
Advantages and disadvantages of the window method.
It is simple to apply and simple to understand. It involves minimum computation.
Lacks flexibility. Both peak pass band and stop-band ripples are nearly equal, limits the choice of
designer.Because of convolution of the spectrum of the
window function and the desired response, pass band and stop-band edge frequencies can not be
precisely specified. Maximum ripple magnitudes in pass-band and stop-band in the filter response is fixed regardless of N
(except in Kaiser Window).
Frequency Sampling Method• Arbitrary frequency response is possible to design. • Since coefficients need not symmetrical, design of
recursive filters possible.• It is possible to compute coefficients as integers.• Unless optimized, the band pass ripple, like in window
method, is not equi height.• Frequency sampling is at equi-angle on unit circle.• Odd coeff. filters will have zeroes at either z = 1 or -1.• Even coefficient filters will simultaneously either have
zeroes or none at z = 1.
Mathematics for Linear Phase response.
• Linear Phase response can be obtained by either even symmetric or, odd symmetric impulse response coefficients.
h n( )1N
0
N 1
k
H k( ) ej2
N
nk
Inverse DFT is expressed as
h n( )1N
0
N 1
k
H k( ) cos2 n k
N
j sin2 n k
N
h n( )1N
0
N 1
k
H k( ) ej2
N
k
ej2
N
nk
h n( )1N
0
N 1
k
H k( ) ej2
N
n ( )k
where = (N-1)/2
h n( )1N
0
N 1
k
H k( ) cos2 n k
N
For all the real coefficients of h(n)
h n( )1N
1
N
21
k
2 H k( ) cos2 n k
N
H 0( )
And if the coefficients are symmetrical too:
For even coefficients, H(0) will be zero.
Example:(Ifeachor: p.382)
Prob.: Design an FIR linear phase filter having pass band 0-5 kHz,
Sampling frequency 18 kHz, filter length 9Soln: N =9 hence N/2 -1 = 4. frequency interval is fs/N = 18/9 = 2 kHz.
|H(k)| = 1 at k =0, 1, 2 = 0 at k= 3, 4
More read Ifeachor PP 382 to 401: matlab: 450 to 453.