
LMSAdaptive |
ptolemy.domains.sdf.lib.LMSAdaptive |
An adaptive filter using the Least-Mean Square (LMS) algorithm, also
known as the stochastic gradient algorithm.
The initial filter coefficients are given by the initialTaps
parameter. The tap values can be observed on the
tapValues output. The default initial taps initialTaps
are {1, 0, 0, 0}. This actor supports decimation, but not interpolation.
When used correctly, this LMS adaptive filter will adapt to try to minimize
the mean-squared error of the signal at its error input.
In order for this to be possible, the output of the filter should
be compared (subtracted from) some reference signal to produce
an error signal.
That error signal should be fed back to the error input.
The stepSize parameter determines the rate of adaptation.
If its magnitude is too large, or if it has the wrong sign, then
the adaptation algorithm will be unstable.
The errorDelay parameter must equal the total number of delays
in the path from the output of the filter back to the error input.
This ensures correct alignment of the adaptation algorithm.
The number of delays must be greater than zero.
This actor is type polymorphic, supporting any data type that
supports multiplication by a scalar (the stepSize) and
addition.
The algorithm is simple. Prior to each invocation of the parent
class (an FIR filter), which computes the output given the input,
this actor updates the coefficients according to the following
formula,
newTapValue = oldTapValue + error * stepSize * tapData
where tapData is the contents of the delay line at
the tap in question.
This assumes that the decimation parameter is set
to 1 (the default). If it has a value different from 1,
the algorithm is slightly more involved. Similarly, this
assumes that the errorDelay is 1.
Author(s): Edward A. Lee
Version:$Id: LMSAdaptive.java,v 1.28 2005/07/08 19:58:44 cxh Exp $
Pt.Proposed Rating:Yellow (eal)
Pt.Accepted Rating:Red (eal)
error
The error input port. The type of this port must match that
of the input port.
tapValues
The output of tap values. This has the same type as the
initialTaps.
errorDelay
The number of samples of delay in the feedback loop that
brings the error back. This has a type integer, and
defaults to 1.
initialTaps
The initial taps of the filter. This has a type of ArrayToken.
By default, it contains the array {1.0, 0.0, 0.0, 0.0},
meaning that the output of the filter is initially
the same as the input, and that the adaptive filter has
four taps.
stepSize
The adaptation step size. This must have a type that can
be multiplied by the input. It defaults to 0.01, a double.