Contents

adaptfilt.blms

FIR adaptive filter that uses BLMS

Syntax

ha = adaptfilt.blms(l,step,leakage,blocklen,coeffs,states)

Description

ha = adaptfilt.blms(l,step,leakage,blocklen,coeffs,states) constructs an FIR block LMS adaptive filter ha, where l is the adaptive filter length (the number of coefficients or taps) and must be a positive integer. l defaults to 10.

step is the block LMS step size. You must set step to a nonnegative scalar. You can use function maxstep to determine a reasonable range of step size values for the signals being processed. When unspecified, step defaults to 0.

leakage is the block LMS leakage factor. It must be a scalar between 0 and 1. If you set leakage to be less than one, you implement the leaky block LMS algorithm. leakage defaults to 1 specifying no leakage in the adapting algorithm.

blocklen is the block length used. It must be a positive integer and the signal vectors d and x should be divisible by blocklen. Larger block lengths result in faster per-sample execution times but with poor adaptation characteristics. When you choose blocklen such that blocklen + length(coeffs) is a power of 2, use adaptfilt.blmsfft. blocklen defaults to l.

coeffs is a vector of initial filter coefficients. it must be a length l vector. coeffs defaults to length l vector of zeros.

states contains a vector of your initial filter states. It must be a length l vector and defaults to a length l vector of zeros when you do not include it in your calling function.

For information on how to run data through your adaptive filter object, see the Adaptive Filter Syntaxes section of the reference page for filter.

Properties

In the syntax for creating the adaptfilt object, the input options are properties of the object created. This table lists the properties for the adjoint LMS object, their default values, and a brief description of the property.

Property

Default Value

Description

Algorithm

None

Defines the adaptive filter algorithm the object uses during adaptation

FilterLength

Any positive integer

Reports the length of the filter, the number of coefficients or taps

Coefficients

Vector of elements

Vector containing the initial filter coefficients. It must be a length l vector where l is the number of filter coefficients. coeffs defaults to length l vector of zeros when you do not provide the argument for input.

States

Vector of elements

Vector of the adaptive filter states. states defaults to a vector of zeros which has length equal to l

Leakage

 

Specifies the leakage parameter. Allows you to implement a leaky algorithm. Including a leakage factor can improve the results of the algorithm by forcing the algorithm to continue to adapt even after it reaches a minimum value. Ranges between 0 and 1.

BlockLength

Vector of length l

Size of the blocks of data processed in each iteration

StepSize

0.1

Sets the block LMS algorithm step size used for each iteration of the adapting algorithm. Determines both how quickly and how closely the adaptive filter converges to the filter solution. Use maxstep to determine the maximum usable step size.

PersistentMemory

false or true

Determine whether the filter states get restored to their starting values for each filtering operation. The starting values are the values in place when you create the filter. PersistentMemory returns to zero any state that the filter changes during processing. States that the filter does not change are not affected. Defaults to false.

Examples

Use an adaptive filter to identify an unknown 32nd-order FIR filter. In this example 500 input samples result in 500 iterations of the adaptation process. You see in the plot that follows the example code that the adaptive filter has determined the coefficients of the unknown system under test.

x  = randn(1,500);        % Input to the filter
b  = fir1(31,0.5);        % FIR system to be identified
no  = 0.1*randn(1,500);   % Observation noise signal
d  = filter(b,1,x)+no;    % Desired signal
mu = 0.008;               % Block LMS step size
n  = 5;                   % Block length
ha = adaptfilt.blms(32,mu,1,n);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;

Based on looking at the figures here, the adaptive filter correctly identified the unknown system after 500 iterations, or fewer. In the lower plot, you see the comparison between the actual filter coefficients and those determined by the adaptation process.

References

Shynk, J.J.,"Frequency-Domain and Multirate Adaptive Filtering," IEEE® Signal Processing Magazine, vol. 9, no. 1, pp. 14-37, Jan. 1992.

Was this topic helpful?