Digital Signal Processing Reference
In-Depth Information
FIGURE 4.25. Spectrum of voice signal corrupted by two sinusoidal signals at frequencies
of 900 and 2700 Hz (obtained with Goldwave).
Example 4.7: FIR Implementation Using Four Different
Methods ( FIR4ways )
Figure 4.26 shows a listing of the program FIR4ways.c , which implements an FIR
filter using four alternative methods for convolving/updating the delay samples. This
example extends Example 4.1, where the first method (method A) is used. In this
first method with two “for” loops, the delay samples are arranged in memory with
the newest sample at the beginning of the buffer and the oldest sample at the end
of the buffer. The convolution starts with the newest sample and the first coefficient
using
() =
()() +
()
(
) +◊◊◊+
(
)
(
(
)
)
yn
h
0
xn
h
1
xn
-
1
hN
-
1
xn
--
N
1
Each data value is “moved down” in memory to update the delay samples, with the
newest sample being the newly acquired input sample. The size of the array for the
delay samples is now set at N
1, not at N , to illustrate the third method (method
C). The other three methods use a buffer size of N for the delay samples. The bottom
(end) of the buffer in this example refers to memory location N , not N
+
+
1. Note
that in this case the unused data x ( n
-
N ) in memory location ( N
+
1) is not updated
by using the index i
N .
The second method (method B) performs the convolution and updates the delay
samples using one loop. The convolution starts with the oldest coefficient and the
<
Search WWH ::




Custom Search