Académique Documents
Professionnel Documents
Culture Documents
FIR filter
The TMS32010 target board (see Chapter 13) is to be used to implement the filter
Table 7.16 Unquantized, h(m), and quantized, hq(m). coefficients for the design
example.
m Unquantized coefficients, h(m) Quantized coefficients, hq(m)
0 -1.534638e-02 -503
1 -5.780550e-05 -2
2 5.023483e-03 165
3 1.266706e-02 415
4 2.108206e-02 691
5 2.776418e-02 910
6 3.005362e-02 985
7 2.586935e-02 848
8 1.444566e-02 473
9 -3.189323e-03 -105
10 -2.416137e-02 -792
11 -4.420712e-02 -1449
12 -5.857453e-02 -1919
13 -6.318557e-02 -2070
14 -5.575461e-02 -1827
15 -3.654699e-02 -1198
16 -8.540099e-03 -280
17 2.308386e-02 756
18 5.201380e-02 1704
19 7.224807e-02 2367
20 7.951681e-02 2606
21 7.224807e-02 2367
22 5.201380e-02 1704
23 2.308386e-02 756
24 -8.540099e-03 -280
25 -3.654699e-02 -1198
26 -5.575461e-02 -1827
27 -6.318557e-02 -2070
28 -5.857453e-02 -1919
29 -4.420712e-02 -1449
30 -2.416137e-02 -792
31 -3.189323e-03 -105
32 1.444566e-02 473
33 2.586935e-02 848
34 3.005362e-02 985
35 2.776418e-02 910
36 2.108206e-02 691
37 1.266706e-02 415
38 5.023482e-03 165
39 -5.780550e-05 -2
40 -1.534638e-02 -503
Solution As discussed earlier, there are ftive steps involved in the design of
an FIR filter.
▪ Step 1: specifications The specifications are already given
▪ Step 2: coefficient calculation We will use the optimal ncthod
to calculate the filter coefficients because it would yield the
lowest number of filter coefficients (for nonrecursive FIR),
and because it is available. We have already computed the
coefficients for this filter in a previous example; see Table 7.7.
The corresponding frequency response is given in Figure 7.13.
▪ Step 3: realization The transversal structure is selected (Figure
7.29(a)), as it leads to the most efficient implementation using
the TMS32010 processor. The difference equation for this
structure is
▪ Step 4: quantization and analysis of errors Since the
TMS32010 is to be used, each coefficient should be quantized
to 16 bits for efficient operation. To do this, we multiply each
coefficient by 215 and then round up to the nearest integer. For
example, the first two coefficients are quantized as follows:
h(0)=-0.015 346 38 x 215 = -502.87 ≈ -503
h(1)=-0.000 057 805 5x 215 = -1.89 ≈ -2
The quantized and unquantized coefficients are listed in Table 7.16. The
frequency response of the quantized filter should be checked
to verify that the specifications are still met, particularly in the
stopband. We found that, after quantization to 16 bits, there
was little difference between the response of the quantized and
unquantized filters.
With the TMS32010, partial sums implied in the difference
equation will be carried out in a 32-bit accumulator. A fairly
wide product register (32 bits) is used. Thus the effects of
roundoff errors for N = 41 will be small. In this example,
overflow is ignored. If it was a concern, we could overcome it
by simply dividing each coefficient oblained in step 2 by a
suitable scale factor, SF, for example
40
S F = ∑ |h(m)|
m=0
The target board has only an 8-bit ADC. This would restrict
the dynamic range of the signal that can be handled to only
about 48 dB. In a high quality audio system, for example, the
level of quantization noise would have been unacceptable, and
in such cases the ADC resolution must be increased.
▪ Step 5: Implementation A flowchart for the FIR filtering
operation is given in Figure 7.35. The flowchart is next
translated into a TMS32010 assembly code and stored in the
program memory (see Chapter 12 for the development and
coding of FIR filtering operations).
7.14 Summary
The design of digital filters can be divided into five interdependent stages: filter
specifications, coefficient calculation, realization, analysis of errors and
flter implementation.
Filter specification is application dependent, but should include a
specification of the amplitude and/or phase characteristics.
Coefficient calculation essentially involves finding values of h(m) that
will satisfy the desired specifications. The three most common methods of
calculating FIR filter coefficients are (1) the window, (2) the frequency
sampling. and 3) the optimal methods. The window method is the easiest,
but lacks flexibility especially when the passband and stopband ripples are
different. The frequency sampling method is well suited to recursive
implementation of FIR filters and when filters other than the standard
frequency selective filters (lowpass, highpass, bandpass and bandstop) are
required. The optimal method is the most powerful and flexible. All three
methods were covered in detail in this chapter.
The three most common FIR filter structures are the transversal, which
involves a direct convolution using the filter coefficients, the frequency
sampling structure, which is directly linked to the frequency sampling
method of coefficient calculation, and the fast convolution. The choice
between the structures is influenced by the intended application.
The performance of FIR filters of long lengths or high stopband
attenuation may be affected by finite wordlength effects. For example,
their frequency responses could be altered after coefficient quantization.
Thus the characteristics of such filters should be checked to ensure that
adequate wordlengths have been allowed, especially when wordlengths of
less than about 12 bits are contemplated.
Implementation is normally embarked on when the first four steps are
satisfactory and involves software coding or hardware realization of the
chosen structure.
where b(n) is related to the filter coeticients. Explain why filters with the response
above are unsuitable as highpass filters. Use a simple case (such as N-4) to
illustrate your answer.
7.2 An FIR filter has an impulse response, h(n), which is defined over the
interval 0 ≤ n ≤ N-1. Show that if N is even and h(n) satisfies the positive
symmetry condition, that is h(n) = h(N-n-1), the flter has a lincar phase
response. Obtain expressions for the amplitude and phase responses of the
filter
Window method
7.3 Show that the impulse response for an ideal bandpass filter (see Table 7.2)
is given by
sin sin n ω 2 sin sin nω 1
ho (n) = 2f 2 nω 2
− 2f 1 nω 1
n≠0
= 2 (f 2 − f 1 ) n=0
where f1 is the lower passband frequency and f2 is the upper passband frequency
7.4 (1) Obtain the coefficients of an FIR lowpass digital filter to meet the
following specifications using the window method:
stopband attenuation 50 dB
passband edge frequency 3.4 kHz
transition width 0.6 kHz
sampling frequency 8 kHz
Include in your answer the type of window used and the reason for
your choice.
(2) Assuming that the filter coefficients are stored in contiguous memory
locations in a microcomputer, list the values of the coefficients in the
order in which they are stored.
(3) Draw and briefly describe a flowchart of the direct software
implementation of the filter in real time, and suggest two ways of
improving the efficiency of the software implementation.
Note: you may use the information given in Table 7.2 in your design.
where
[ 2
C ω (δ p , δ s ) = [δ s ] b1 (δ p ) + b2 δ p + b3 ] + [b (δ
4 p
2
) + b5 δ p + b6 ]
∆ F, transition width normalized to the sampling frequency
Suggest a suitable grid density for the above problem. You may use the
information given in Table 7.17
7.6 An FIR lowpass digital filter is required to meet the following
specifications:
stopband attenuation > 40 dB
passband edge frequency 100 Hz
passband ripple < 0.05 dB
transition width 10 Hz
sampling frequency 1024 Hz
(1) Calculate and list the coefficients of the filter indicating clearly the
method you used and why you chose it.
(2) The filter is to be implemented for real-time operation using the fast
convolution method Outline how you would implement the filter with
the FT using the overlap-save technique. Indicate clearly parameters
such as the number of samples by which the input sections overlap, the
length of sections, the size of the transforms used and how the output
samples are extracted from the transforms.
7.7 A linear phase, 41-point FIR differentiator is to be designed to meet the
following specifications:
passband edge frequency 1 kHz
stopband edge frequency 1.5 kHz
sampling frequency 10 kHz
passband deviation 0.01
stopband deviation 0.01
Calculate the coefficients of the differentiator using the optimal method
(Parks-McClellan/ Remez exchange algorithm). Plot its magnitude-
frequency response
7.8 A linear phase, 43-point FIR Hilbert transform filter is to be designed to
meet the following specifications:
lower bandedge frequency 1 kHz
upper bandedge frequency 4.5 kHz
sampling frequency 10 kHz
passband deviation 0.01
Calculate the coefficients of the filter using the optimal method. Plot its
magnitude-frequency response in dB
(d) Explain how the radix-2 FFT flow graph of Figure 7.36(b) may be
used to calculate the impulse response of the filter from the frequency
samples obtained above.
7.12 (a) Explain, widh the aid of sketches, the basic concepts of the frequency
sampling filter design method.
(b) A requirement exists for a lowpass digital filter satisfying the
following requirements
passband 0-20 Hz
sampling frequency 300 Hz
stopband attenuation > 50 dB
filter length 15
Table 7.18 Optimum transition band frequency samples for type I lowpass
frequency sampling filters for N=15 (adapted from Rabiner et al,
1970)
Stopband attenuation
BW T1 T2 T3
(dB)
One transition band frequency sample, N=15
1 42.309 322 83 0.433 782 96
2 41.262 992 86 0.417 938 23
3 41.253 337 86 0.410 473 63
4 41.949 077 13 0.404 058 84
5 44.371 245 38 0.392 681 89
6 56.014 165 88 0.357 665 25
Two transition band frequency samples, N=15
1 70.605 405 85 0.095 001 22 0.589 954 18
2 69.261 681 56 0 103 198 24 0.593 571 18
3 69.919 734 95 0.100 836 18 0.589 432 70
4 75.511 722 56 0.084 074 93 0.557 153 12
5 103.460 783 00 0.051 802 06 0.499 174 24
Three transition band frequency samples, N=15
1 94.611 661 91 0.014 550 78 0.184 578 82 0.668 976 13
2 104.998 130 80 0.010 009 77 0.173 607 13 0.659 515 26
3 114.907 193 18 0.008 734 13 0.163 973 10 0.647 112 64
4 157.292 575 84 0.003 787 99 0.123 939 63 0.601 811 54
BW refers to the number of frequency samples in the passband
(c) Find the coefficients of the transfer function of the digital filter. in recursive
form, using the
frequency sampling method and the information in Table 7.18.
(i) Develop and draw the realization diagram for the filter and
compare the storage and computational requirements of the
recursive implementation with direct form FIR.
(ii) Explain why the filter represented by the transfer function above
is still an FIR filter even though its transfer function indicates
that it is a recursive filter. Comment on the difficulties that may
be encountered in practice with recursive frequency sampling
filters and indicate how these may be overcome.
Figure 7.37
7.15 (1) Discuss briefly the conditions necessary for a realizable digital filter to
have a linear phase characteristic, and the advantages of filters with
such a characteristic
(2) In a ceriain signal processing application. the input signal, with
significant frequency components in the range 0 ≤ f ≤ 10 Hz, is
contaminated by a 50 Hz mains interference. It is decided to remove
the interference using a linear phase digital filter after digitizing the
composite signal at a rate of 500 samples s-1. As a first step in the
design of the filter, the pole-zero diagram given in Figure 7.39 was
developed. Obtain the transfer function, H(z), of the filter and its
difference equation.
(3) The filter obtained in part (2) is to be implemented in a microcomputer
with simple arithmetic limited to only additions/subtractions and shifts.
Redesign the filter so that its coefficients are integers. There should be
no increase in the number of filter coefficients or sampling rate.
(4) Show that the phase response, θ ( ω ), of the filter of part (3) is given
by
θ (ω) =− ωT
Figure 7.39 Pole-zero diagram for Problem 7.15; ω 0 T = π5 rad.
7.16 (1) A requirement exists for a real-time, narrowband, linear phase digital
filter for a certain biomedical system. Justify the use of filter for the
system.
Assume that the transfer function of an N-point frequency
sampling filter is given by
1−rN z −N
H (z) = N
( )
M
|H(k)|[2 cos(2πkα/N )−2r cos[2πk(1+α)/N ] H(0)
∑ 1−2r cos(2πk/N )z −1 +r2 z −2
+ 1−z −1
k=1
where the H(k) are the samples of the desired frequency response taken
at intervals of Fs/Ns, α=(N-1)/2.
(2) The desired filter is characterized by the following specifications:
passband 48-52 Hz
transition width 2 Hz
sampling frequency 500 Hz
stopband attenuation > 60 Db
Specify suitable frequeney samples, |H(k)| Develop and draw the realization
diagram for the filter, How does the filter compare with an equivalent
transversal structure interms of storage and computational
requirements?
(3) Comment on the H(z) above and the difficulties that may be
encountered in practice with recursive frequency sampling filters, and
indicate how these may be overcome.
Explain why H(z) describes a recursive filter and yet its unit
impulse response, h(n), is of a finite duration.
7.17 A requirement exists for an N-point FIR filter with the frequency response
H (ejω ) = ||H(ejω )|| e−jωα
{ }
N /2−1
1
h (n) = N
∑ 2|H (k) |cos[2π(n − α)(k + 1/2)/N ]
k=0
{
( N3 )−1
h (n) = 1
N
∑ 2 |H (k)| cos cos
k=0
[ 2π(n−α)(k+ 12 )
N ] + H [(N − 1)/2]cos [π (n
(3) Obtain an expression for the transfer function, H(z), in recursive from
for each of parts (1) and (2).