Digital Signal Processing Reference
In-Depth Information
TABLE 4.2
Memory Organization to Illustrate Update of Samples
Samples
Coefficients
Time n
Time n + 1
Time n + 2
h(0)
x(n)
x(n + 1)
x(n + 2)
h(1)
x(n - 1)
x(n)
x(n + 1)
h(2)
x(n - 2)
x(n - 1)
x(n)
.
.
.
.
.
.
.
.
.
.
.
.
h(N - 3)
x(n - (N - 3))
x(n - (N - 4))
x(n - (N - 5))
h(N - 2)
x(n - (N - 2))
x(n - (N - 3))
x(n - (N - 4))
h(N - 1)
x(n - (N - 1))
x(n - (N - 2))
x(n - (N - 3))
Time n
+
1
At time n
1) is acquired and stored at the top of the
sample buffer, as shown in Table 4.2. The output y ( n
+
1, a new input sample x ( n
+
+
1) can now be calculated as
(
) =
()
(
) +
() ( ) +◊◊◊+
(
)
(
(
)
)
yn
+
1
h
0
xn
+
1
h
1
xn
hN
-
2
xn
--
N
3
(
)
(
(
)
)
+-
hN
1
xn
--
N
2
The samples are then updated for the next unit of time.
Time n
+
2
At time n
+
2, a new input sample, x ( n
+
2), is acquired. The output becomes
(
) =
()
(
) +
()
(
) +◊◊◊+
(
)
(
(
)
)
yn
+
2
h
0
xn
+
2
h
1
xn
+
1
hN
-
1
xn
--
N
3
This process continues to calculate the filter's output and updating the delay samples
at each unit of time (sample period).
Example 4.7 illustrates four different ways of arranging the coefficients and
samples in memory and of calculating the convolution equation (e.g., the newest
sample at the end of the buffer and the oldest sample at the beginning).
Example 4.1: FIR Filter Implementation: Bandstop and Bandpass ( FIR )
Figure 4.5 shows a listing of the C source program FIR.c , which implements an
FIR filter. It is a generic FIR program, since the coefficient file included,
bs2700.cof (Figure 4.6), specifies the filter's characteristics. This coefficient file,
which contains 89 coefficients, represents an FIR bandstop (notch) filter centered
at 2700 Hz. The number of coefficients N is defined in the coefficient file. This filter
was designed using MATLAB's graphical user interface (GUI) filter designer
SPTool, described in Appendix D [50]. Figure 4.7 shows the filter's characteristics
(MATLAB's order of 88 corresponds to 89 coefficients). MATLAB's FDATool can
be used in the place of SPTool (see Appendix D).
Search WWH ::




Custom Search