FIR adaptive filter that uses filtered-x LMS
ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,
For information on how to run data through your adaptive filter object, see the Adaptive Filter Syntaxes section of the reference page for filter.
Entries in the following table describe the input arguments for adaptfilt.filtxlms.
Adaptive filter length (the number of coefficients or taps) and it must be a positive integer. l defaults to 10.
Filtered LMS step size. it must be a nonnegative scalar. step defaults to 0.1.
is the filtered-x LMS leakage factor. it must be a scalar between 0 and 1. If it is less than one, a leaky version of adaptfilt.filtxlms is implemented. leakage defaults to 1 (no leakage).
is the secondary path filter model. this vector should contain the coefficient values of the secondary path from the output actuator to the error sensor.
is the estimate of the secondary path filter model. pathest defaults to the values in pathcoeffs.
is a vector of filtered input states of the adaptive filter. fstates defaults to a zero vector of length equal to (l - 1).
are the secondary path FIR filter states. it must be a vector of length equal to the (length(pathcoeffs) - 1). pstates defaults to a vector of zeros of appropriate length.
is a vector of initial filter coefficients. it must be a length l vector. coeffs defaults to length l vector of zeros.
Vector of initial filter states. states defaults to a zero vector of length equal to the larger of (length(pathcoeffs) - 1) and (length(pathest) - 1).
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.
Defines the adaptive filter algorithm the object uses during adaptation
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.
Vector of filtered input states with length equal to l - 1.
Any positive integer
Reports the length of the filter, the number of coefficients or taps
Vector of elements
Vector of the adaptive filter states. states defaults to a vector of zeros which has length equal to (l + projectord - 2)
A vector that contains the coefficient values of your secondary path from the output actuator to the error sensor
An estimate of the secondary path filter model
Vector of size (length (pathcoeffs) -1) with all elements equal to zero.
The states of the secondary path FIR filter — the unknown system
Sets the filtered-x 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.
Demonstrate active noise control of a random noise signal over 1000 iterations.
As the figure that follows this code demonstrates, the filtered-x LMS filter successfully controls random noise in this context.
x = randn(1,1000); % Noise source g = fir1(47,0.4); % FIR primary path system model n = 0.1*randn(1,1000); % Observation noise signal d = filter(g,1,x)+n; % Signal to be cancelled b = fir1(31,0.5); % FIR secondary path system model mu = 0.008; % Filtered-X LMS step size ha = adaptfilt.filtxlms(32,mu,1,b); [y,e] = filter(ha,x,d); plot(1:1000,d,'b',1:1000,e,'r'); title('Active Noise Control of a Random Noise Signal'); legend('Original','Attenuated'); xlabel('Time Index'); ylabel('Signal Value'); grid on;