Adapt Multiple Filters Using LMS Update block
This example shows how to adapt multiple filters independently using the same LMS Update block.
Adapt Both Filters
Multifiltersupport model. The LMS Update block in the model has the following settings:
Number of adaptive filters is set to 2.
Filter length is set to 3 taps.
Adaptive filter mode is set to
Tapped delay-line FIR filter.
The signal at the Input port is a random signal with a uniform distribution. This signal has a sample time of 0.01 s and contains 1 sample per frame.
The error signals from filter 1 and filter 2 are generated through a series of Discrete FIR Filter blocks. The first and the third Discrete FIR Filter blocks generate the desired signal using the expected fixed weights. The second and the fourth Discrete FIR Filter blocks generate the actual output using the weights estimated by the LMS Update block.
The Matrix Concantenate block concatenates the two error signals and passes the concatenated signal back to the LMS Update block through the Error port. This error signal is used to further adapt the filters in the direction of convergence.
Run the model.
Both the filters are adapted. The weights estimated by the LMS Update block for both the filters converge towards the actual weights.
Adapt Filters Selectively
You can optionally select the individual filters to adapt by providing an appropriate value at the Adapt port. When the Adapt port input element is not 0, the block updates the filter weights. When the input is 0, the filter weights do not change.
Multifiltersupport_Adapt model. The Enable adapt input parameter is selected in the LMS Update block. This setting enables the Adapt port. The top portion of the model generates the Adapt signal.
Run the model.
The first filter is enabled to adapt and the second filter is not. The weights of the first filter converge towards the expected weights, while the weights of the second filter do not change from their initial values (which is 0 in this case).