Documentation Center |
FIR adaptive filter that uses filtered-x LMS
ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,
pathest,...errstates,pstates,coeffs,states)
ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,
pathest,...errstates,pstates,coeffs,states) constructs
an filtered-x LMS adaptive filter ha.
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.
Input Argument | Description |
---|---|
l | Adaptive filter length (the number of coefficients or taps) and it must be a positive integer. l defaults to 10. |
step | Filtered LMS step size. it must be a nonnegative scalar. step defaults to 0.1. |
leakage | 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). |
pathcoeffs | 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. |
pathest | is the estimate of the secondary path filter model. pathest defaults to the values in pathcoeffs. |
fstates | is a vector of filtered input states of the adaptive filter. fstates defaults to a zero vector of length equal to (l - 1). |
pstates | 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. |
coeffs | is a vector of initial filter coefficients. it must be a length l vector. coeffs defaults to length l vector of zeros. |
states | 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.
Property | Default Value | Description |
---|---|---|
Algorithm | None | Defines the adaptive filter algorithm the object uses during adaptation |
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. |
FilteredInputStates | l-1 | Vector of filtered input states with length equal to l - 1. |
FilterLength | Any positive integer | Reports the length of the filter, the number of coefficients or taps |
States | Vector of elements | Vector of the adaptive filter states. states defaults to a vector of zeros which has length equal to (l + projectord - 2) |
SecondaryPathCoeffs | No default | A vector that contains the coefficient values of your secondary path from the output actuator to the error sensor |
SecondaryPathEstimate | pathcoeffs values | An estimate of the secondary path filter model |
SecondaryPathStates | Vector of size (length (pathcoeffs) -1) with all elements equal to zero. | The states of the secondary path FIR filter — the unknown system |
StepSize | 0.1 | 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;