Digital Signal Processing Reference
In-Depth Information
1. Obtain a known analog transfer function H ( s ).
2. Prewarp the desired digital frequency
w D to obtain the analog frequency
w A
in (5.32).
3. Scale the frequency of the analog transfer function H ( s ) selected, using
() =w
Hs ss A
(5.34)
4. Obtain H ( z ) using the BLT equation (5.29), or
() =
(
)
Hz
H s
w
(5.35)
(
)
(
)
Asz
=-
1
z
+
1
In the case of bandpass and bandstop filters with lower and upper cutoff frequen-
cies
w A 2 need to be solved. The
exercises in Appendix D further illustrate the BLT procedure.
w D 1 and
w D 2 , the two analog frequencies
w A 1 and
5.4 PROGRAMMING EXAMPLES USING C AND ASM CODE
Several examples are introduced to illustrate the implementation of an IIR filter
using the cascaded direct form II structure and the generation of a tone using a
difference equation. An example illustrates the generation of a tone with an
assembly-coded function.
Example 5.1: IIR Filter Implementation Using Second-Order
Stages in Cascade ( IIR )
Figure 5.14 shows a listing of the program IIR.c that implements a generic IIR
filter using cascaded second-order stages (sections). The program uses the follow-
ing two equations associated with each stage (see equations 5.10 and 5.11 for a
second-order):
u ( n ) = x ( n ) - b 1 u ( n - 1) - b 2 u ( n - 2)
y ( n ) = a 0 u ( n ) + a 1 u ( n - 1) + a 2 u ( n - 2)
The loop section of code within the program is processed five times (the number of
stages) for each value of n , or sample period. For the first stage, x(n) is the newly
acquired input sample. However, for the other stages, the input x(n) is the output
y(n) of the preceding stage.
The coefficients b[i][0] and b[i][1] correspond to b 1 and b 2 , respectively;
where i represents each stage. The delays dly[i][0] and dly[i][1] correspond
to u ( n - 1) and u ( n - 2) , respectively.
Search WWH ::




Custom Search