Digital Signal Processing Reference
In-Depth Information
Example 7.2: Adaptive Filter for Sinusoidal Noise Cancellation
( adaptnoise )
This example illustrates the application of the LMS criterion to cancel an undesir-
able sinusoidal noise. Figure 7.14 shows a listing of the program adaptnoise.c ,
which implements an adaptive FIR filter using the structure in Figure 7.2.
A desired sine wave of 1500 Hz with an additive (undesired) sine wave noise of
312 Hz forms one of two inputs to the adaptive filter structure. A reference (tem-
plate) cosine signal, with a frequency of 312 Hz, is the input to a 30-coefficient adap-
tive FIR filter. The 312-Hz reference cosine signal is correlated with the 312-Hz
additive sine noise but not with the 1500-Hz desired sine signal.
For each time n , the output of the adaptive FIR filter is calculated and the 30
weights or coefficients are updated along with the delay samples. The “error” signal
E is the overall desired output of the adaptive structure. This error signal is the dif-
ference between the desired signal and additive noise ( dplusn ) and the adaptive
filter's output, y ( n ).
All signals used are from a lookup table generated with MATLAB. No external
inputs are used in this example. Figure 7.15 shows a MATLAB program adapt -
noise . m (a more complete version is on the CD) that calculates the data values for
the desired sine signal of 1500 Hz, the additive noise as a sine of 312 Hz, and the ref-
erence signal as a cosine of 312 Hz. The appropriate files generated (on the CD) are:
1. dplusn : sine(1500 Hz)
sine(312 Hz)
2. refnoise : cosine(312 Hz)
+
Figure 7.16 shows the file sin1500 . h with sine data values that represent the
1500-Hz sine-wave signal desired. The frequency generated associated with
sinl500.h is
= (
) (
) =
() =
f
#
of cycles
#
of points
8000 24
128
1500
Hz
s
The constant beta determines the rate of convergence.
Build and run this project as adaptnoise . Verify the following output result:
The undesired 312-Hz sinusoidal signal is being gradually reduced (canceled), while
the desired 1500-Hz signal remains. Note that in this application the output desired
is the error signal E , which adapts (converges) to the desired signal. A faster rate
of cancellation can be observed with a larger value of beta . However, if beta is
too large, the adaptation process will not be observed since the output would be
shown as the 1500-Hz signal. With the slider in position 2, the output is ( dplusn ),
the desired 1500-Hz sinusoidal signal with the additive 312-Hz noise signal.
Search WWH ::




Custom Search