−6 −4 −2 0 2 4 In−Phase Components Time Index Signal Value Desired Output Error 0 200 400 600 800 1000 −4 −2 0 2 4 Quadrature Components Time Index Signal Value Desired Output Error −2 0 2 −3 −2 −1 0 1 2 3
Received Signal Scatter Plot
Real[x] Imag[x] −2 0 2 −3 −2 −1 0 1 2 3
Equalized Signal Scatter Plot
Real[y]
Imag[y]
See Also
adaptfilt.qrdlsl,adaptfilt.gal,adaptfilt.ftf,adaptfilt.rlsReferences
Haykin, S., Adaptive Filter Theory, 2nd Edition, Prentice Hall, N.J., 1991Purpose
FIR adaptive filter that uses NLMSSyntax
ha = adaptfilt.nlms(l,step,leakage,offset,coeffs,states)Description
ha = adaptfilt.nlms(l,step,leakage,offset,coeffs,states)constructs a normalized least-mean squares (NLMS) FIR adaptive filter object namedha.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.nlms.
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 NLMS step size. It must be a scalar between 0
and 2. Setting this step size value to one provides the fastest convergence. stepdefaults to 1. leakage NLMS leakage factor. It must be a scalar between
zero and one. When it is less than one, a leaky NLMS algorithm results. leakagedefaults to 1
(no leakage).
offset Specifies an optional offset for the denominator
of the step size normalization term. You must specify offset to be a scalar greater than or equal to zero. Nonzero offsets can help avoid a divide-by-near-zero condition that causes errors. Use this to avoid dividing by zero (or by very small numbers) when the square of the input data norm becomes very small (when the input signal amplitude becomes very small). When you omit it,
adaptfilt.nlms
Input
Argument Description
coeffs Vector composed of your initial filter coefficients.
Enter a lengthlvector. coeffsdefaults to a
vector of zeros with length equal to the filter order.
states Your initial adaptive filter states appear in the statesvector. It must be a vector of lengthl-1. statesdefaults to a lengthl-1 vector with zeros
for all of the elements.
Properties
In the syntax for creating theadaptfiltobject, the input options areproperties of the object you create. This table lists the properties for normalized LMS objects, their default values, and a brief description of the property.
Property Range Property Description
Algorithm None Reports the adaptive filter
algorithm the object uses during adaptation
Coefficients Vector of
elements Vector containing the initialfilter coefficients. It must be a length lvector wherel is the
number of filter coefficients.
coeffs defaults to lengthl
vector of zeros when you do not provide the argument for input.
FilterLength Any positive
Property Range Property Description
Leakage 0 to 1 NLMS leakage factor. It must
be a scalar between zero and one. When it is less than one, a leaky NLMS algorithm results. leakagedefaults to 1 (no
leakage).
Offset 0 or greater Specifies an optional offset for
the denominator of the step size normalization term. You must specify offset to be a scalar greater than or equal to zero. Nonzero offsets can help avoid a divide-by-near-zero condition that causes errors. Use this to avoid dividing by zero (or by very small numbers) when the square of the input data norm becomes very small (when the input signal amplitude becomes very small). When you omit it,
offsetdefaults to zero. PersistentMemory falseortrue Determine whether the filter
states and coefficients get restored to their starting values for each filtering operation. The starting values are the values in place when you create the filter.
PersistentMemoryreturns to
zero any property value that the filter changes during processing. Property values that the filter does not change are not affected. Defaults tofalse.
adaptfilt.nlms
Property Range Property Description
States Vector of
elements, data type double
Vector of the adaptive filter states. statesdefaults to a
vector of zeros which has length equal to (l- 1).
StepSize 0 to 1 NLMS step size. It must be a
scalar between zero and one. Setting this step size value to one provides the fastest convergence.
stepdefaults to one.
Example
To help you compare this algorithm’s performance to other LMS-based algorithms, such as BLMS or LMS, this example demonstrates the NLMS adaptive filter in use to identify the coefficients of an unknown FIR filter of order equal to 32 — an example used in other adaptive filter examples.x = randn(1,500); % Input to the filter
b = fir1(31,0.5); % FIR system to be identified
n = 0.1*randn(1,500); % Observation noise signal
d = filter(b,1,x)+n; % Desired signal
mu = 1; % NLMS step size offset = 50; % NLMS offset ha = adaptfilt.nlms(32,mu,1,offset); [y,e] = filter(ha,x,d); subplot(2,1,1); plot(1:500,[d;y;e]); legend('Desired','Output','Error');
title('System Identification of FIR Filter'); xlabel('Time Index'); ylabel('Signal Value'); subplot(2,1,2);
stem([b', ha.coefficients']);
legend('Actual','Estimated'); grid on;
0 50 100 150 200 250 300 350 400 450 500 −2 −1 0 1 2 3
System Identification of an FIR Filter
Time Index Signal Value Desired Output Error 0 5 10 15 20 25 30 35 −0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 Coefficient # Coefficient Value Actual Estimated
As you see from the figure, thenlmsvariant again closely matches the
actual filter coefficients in the unknown FIR filter.
See Also
adaptfilt.ap,adaptfilt.apru,adaptfilt.lms,adaptfilt.rls, adaptfilt.swrlsadaptfilt.pbfdaf
Purpose
FIR adaptive filter that uses PBFDAF with bin step size normalizationSyntax
ha = adaptfilt.pbfdaf(l,step,leakage,delta,lambda,blocklen, offset,coeffs,states)Description
ha = adaptfilt.pbfdaf(l,step,leakage,delta,lambda,blocklen, offset,coeffs,states) constructs a partitioned blockfrequency-domain FIR adaptive filterhathat uses bin step size
normalization during adaptation.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.pbfdaf.
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 Step size of the adaptive filter. This is a scalar and
should lie in the range (0,1].stepdefaults to 1. leakage Leakage parameter of the adaptive filter. When
you set this argument to a value between zero and one, a leaky version of the PBFDAF algorithm is implemented.leakagedefaults to 1— no leakage. delta Initial common value of all of the FFT input signal
powers. Its initial value should be positive. delta defaults to 1.
lambda Averaging factor used to compute the exponentially
windowed FFT input signal powers for the coefficient updates.lambdashould lie in the range (0,1]. lambda
Input
Argument Description
blocklen Block length for the coefficient updates. This must
be a positive integer such that (l/blocklen) is also
an integer. For faster execution,blocklenshould be
a power of two. blocklendefaults to two.
offset Offset for the normalization terms in the coefficient
updates. This can be useful to avoid divide by zeros conditions, or dividing by very small numbers, if any of the FFT input signal powers become very small.
offsetdefaults to zero.
coeffs Initial time-domain coefficients of the adaptive filter.
It should be a vector of lengthl. The PBFDAF
algorithm uses these coefficients to compute the initial frequency-domain filter coefficient matrix via FFTs.
states Specifies the filter initial conditions.statesdefaults
to a zero vector of lengthl.
Properties
Since youradaptfilt.pbfdaffilter is an object, it has properties thatdefine its behavior in operation. Note that many of the properties are also input arguments for creatingadaptfilt.pbfdafobjects. To
show you the properties that apply, this table lists and describes each property for the filter object.
adaptfilt.pbfdaf
Name Range Description
Algorithm None Defines the adaptive filter
algorithm the object uses during adaptation.
AvgFactor Averaging factor used to
compute the exponentially windowed FFT input signal powers for the coefficient updates. AvgFactorshould lie
in the range (0,1]. AvgFactor
defaults to 0.9. Calledlambda
as an input argument.
BlockLength Block length for the coefficient
updates. This must be a positive integer such that (l/blocklen) is also an integer.
For faster execution,blocklen
should be a power of two.
blocklendefaults to two. FilterLength Any positive
integer Reports the length of the filter,the number of coefficients or taps.
FFTCoefficients Stores the discrete Fourier
transform of the filter coefficients incoeffs. FFTStates States for the FFT operation.
Name Range Description
Leakage 0 to 1 Leakage parameter of the
adaptive filter. When you set this argument to a value between zero and one, a leaky version of the PBFDAF algorithm is implemented.
leakagedefaults to 1 — no
leakage.
Offset Offset for the normalization
terms in the coefficient updates. This can be useful to avoid divide by zeros conditions, or dividing by very small numbers, if any of the FFT input signal powers become very small.
offsetdefaults to zero. 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.
PersistentMemoryreturns to
zero any state that the filter changes during processing. States that the filter does not change are not affected. Defaults tofalse.
adaptfilt.pbfdaf
Name Range Description
Power A vector of 2*lelements, each
initialized with the valuedelta
from the input arguments. As you filter data,Power gets
updated by the filter process.
StepSize 0 to 1 Step size of the adaptive filter.
This is a scalar and should lie in the range (0,1].stepdefaults
to 1.
Examples
An example of Quadrature Phase Shift Keying (QPSK) adaptive equalization using a 32-coefficient FIR filter.D = 16; % Number of samples of delay
b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients of channel
a = [1 -0.7]; % Denominator coefficients of channel
ntr = 1000; % Number of iterations
s = sign(randn(1,ntr+D))+j*sign(randn(1,ntr+D)); % Baseband QPSK signal
n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal
r = filter(b,a,s)+n; % Received signal
x = r(1+D:ntr+D); % Input signal (received signal)
d = s(1:ntr); % Desired signal (delayed QPSK signal)
del = 1; % Initial FFT input powers
mu = 0.1; % Step size
lam = 0.9; % Averaging factor
N = 8; % Block size
ha = adaptfilt.pbfdaf(32,mu,1,del,lam,N); [y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components'); legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value'); subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot');
axis('square'); xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot');
axis('square'); xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
In the figure shown, the four subplots provide the details of the results of the QPSK process used in the equalization for this example.
0 200 400 600 800 1000 −2 −1 0 1 2 In−Phase Components Time Index Signal Value Desired Output Error 0 200 400 600 800 1000 −1.5 −1 −0.5 0 0.5 1 1.5 2 Quadrature Components Time Index Signal Value Desired Output Error −2 0 2 −3 −2 −1 0 1 2 3
Received Signal Scatter Plot
Real[x] Imag[x] −2 0 2 −3 −2 −1 0 1 2 3
Equalized Signal Scatter Plot
Real[y]
Imag[y]
adaptfilt.pbfdaf
References
So, J.S. and K.K. Pang, “Multidelay Block Frequency Domain Adaptive Filter,” IEEE Trans. Acoustics, Speech, and Signal Processing, vol. 38, no. 2, pp. 373-376, February 1990Paez Borrallo, J.M.and M.G. Otero, “On The Implementation of a Partitioned Block Frequency Domain Adaptive Filter (PBFDAF) For Long Acoustic Echo Cancellation,” Signal Processing, vol. 27, no. 3, pp. 301-315, June 1992
Purpose
FIR adaptive filter that uses PBUFDAF with bin step size normalizationSyntax
ha = adaptfilt.pbufdaf(l,step,leakage,delta,lambda, blocklen,...offset,coeffs,states)Description
ha = adaptfilt.pbufdaf(l,step,leakage,delta,lambda,blocklen,...offset,coeffs,states)constructs a partitioned block
unconstrained frequency-domain FIR adaptive filterhawith bin step
size normalization.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.pbufdaf.
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 Step size of the adaptive filter. This is a scalar and
should lie in the range (0,1]. stepdefaults to 1. leakage Leakage parameter of the adaptive filter. When
you set this argument to a value between zero and one, a leaky version of the PBFDAF algorithm is implemented.leakagedefaults to 1 — no leakage. delta Initial common value of all of the FFT input signal
powers. Its initial value should be positive. delta defaults to 1.
lambda Averaging factor used to compute the
exponentially windowed FFT input signal powers for the coefficient updates. lambdashould lie in
adaptfilt.pbufdaf
Input
Argument Description
blocklen Block length for the coefficient updates. This must
be a positive integer such that (l/blocklen) is also
an integer. For faster execution,blocklenshould
be a power of two.blocklendefaults to two. offset Offset for the normalization terms in the
coefficient updates. This can be useful to avoid divide by zeros conditions, or dividing by very small numbers, if any of the FFT input signal powers become very small. offsetdefaults to
zero.
coeffs Initial time-domain coefficients of the adaptive
filter. It should be a vector of lengthl. The
PBFDAF algorithm uses these coefficients to compute the initial frequency-domain filter coefficient matrix via FFTs.
states Specifies the filter initial conditions. states
defaults to a zero vector of lengthl.
Properties
Since youradaptfilt.pbufdaffilter is an object, it has properties thatdefine its behavior in operation. Note that many of the properties are also input arguments for creatingadaptfilt.pbufdafobjects. To
show you the properties that apply, this table lists and describes each property for the filter object.
Name Range Description
Algorithm None Defines the adaptive filter
algorithm the object uses during adaptation
AvgFactor Averaging factor used to
compute the exponentially windowed FFT input signal powers for the coefficient updates. AvgFactorshould lie
in the range (0,1]. AvgFactor
defaults to 0.9. Calledlambda
as an input argument.
BlockLength Block length for the coefficient
updates. This must be a positive integer such that (l/blocklen)
is also an integer. For faster execution,blocklenshould be a
power of two.blocklendefaults
to two.
FilterLength Any positive
integer Reports the length of the filter,the number of coefficients or taps
FFTCoefficients Stores the discrete Fourier
transform of the filter coefficients incoeffs. FFTStates States for the FFT operation.
adaptfilt.pbufdaf
Name Range Description
Leakage 0 to 1 Leakage parameter of the
adaptive filter. When you set this argument to a value between zero and one, a leaky version of the PBFDAF algorithm is implemented.
leakagedefaults to 1 — no
leakage.
Offset Offset for the normalization
terms in the coefficient updates. This can be useful to avoid divide by zeros conditions, or dividing by very small numbers, if any of the FFT input signal powers become very small.voffset
defaults to zero.
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.
PersistentMemoryreturns to
zero any state that the filter changes during processing. States that the filter does not change are not affected. Defaults tofalse.
Name Range Description
Power 2*lelement
vector A vector of 2*initialized with the valuelelements, eachdelta
from the input arguments. As you filter data,Powergets
updated by the filter process.
StepSize 0 to 1 Step size of the adaptive filter.
This is a scalar and should lie in the range (0,1].stepdefaults to
1.
Examples
Demonstrating Quadrature Phase Shift Keying (QPSK) adaptive equalization using a 32-coefficient FIR filter. To perform the equalization, this example runs for 1000 iterations.D = 16; % Number of samples of delay
b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients of channel
a = [1 -0.7]; % Denominator coefficients of channel
ntr= 1000; % Number of iterations
s = sign(randn(1,ntr+D))+j*sign(randn(1,ntr+D)); % Baseband QPSK signal
n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal
r = filter(b,a,s)+n; % Received signal
x = r(1+D:ntr+D); % Input signal (received signal)
d = s(1:ntr); % Desired signal (delayed QPSK signal)
del = 1; % Initial FFT input powers
mu = 0.1; % Step size
lam = 0.9; % Averaging factor
N = 8; % Block size
ha = adaptfilt.pbufdaf(32,mu,1,del,lam,N); [y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components'); legend('Desired','Output','Error'); xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components');
adaptfilt.pbufdaf
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]); title('Received Signal Scatter Plot'); axis('square'); xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]); title('Equalized Signal Scatter Plot'); axis('square'); xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
You can compare this algorithm to another, such as thepbfdafversion.
Use the same example of QPSK adaptation. The following figure shows the results. 0 200 400 600 800 1000 −2 −1 0 1 2 3 In−Phase Components Time Index Signal Value 0 200 400 600 800 1000 −2 −1 0 1 2 3 Quadrature Components Time Index Signal Value −2 0 2 −3 −2 −1 0 1 2 3
Received Signal Scatter Plot
Real[x] Imag[x] −2 0 2 −3 −2 −1 0 1 2 3
Equalized Signal Scatter Plot
Real[y] Imag[y] Desired Output Error Desired Output Error
References
So, J.S. and K.K. Pang, “Multidelay Block Frequency Domain Adaptive Filter,” IEEE Trans. Acoustics, Speech, and Signal Processing, vol. 38, no. 2, pp. 373-376, February 1990Paez Borrallo, J.M. and M.G. Otero, “On The Implementation of a Partitioned Block Frequency Domain Adaptive Filter (PBFDAF) for Long Acoustic Echo Cancellation,” Signal Processing, vol. 27, no. 3, pp. 301-315, June 1992
adaptfilt.qrdlsl
Purpose
Adaptive filter that uses QR-decomposition-based LSLSyntax
ha = adaptfilt.qrdlsl(l,lambda,delta,coeffs,states)Description
ha = adaptfilt.qrdlsl(l,lambda,delta,coeffs,states)returns aQR-decomposition-based least squares lattice adaptive filterha.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.qrdlsl.
Input
Argument Description
l Length of the joint process filter coefficients. It
must be a positive integer and must be equal to the length of the prediction coefficients plus one. L defaults to 10.
lambda Forgetting factor of the adaptive filter. This is a
scalar and should lie in the range (0, 1]. lambda
defaults to 1. lambda= 1 denotes infinite memory
while adapting to find the new filter.
delta Soft-constrained initialization factor in the least
squares lattice algorithm. It should be positive.
deltadefaults to 1.
coeffs Vector of initial joint process filter coefficients. It
must be a lengthl vector. coeffsdefaults to a
lengthlvector of all zeros.
states Vector of the angle normalized backward prediction
error states of the adaptive filter
Properties
Since youradaptfilt.qrdlslfilter is an object, it has properties thatdefine its behavior in operation. Note that many of the properties are also input arguments for creatingadaptfilt.qrdlslobjects. To
show you the properties that apply, this table lists and describes each property for the filter object.
Name Range Description
Algorithm None Defines the adaptive filter
algorithm the object uses during adaptation
BkwdPrediction Returns the predicted samples
generated during adaptation. Refer to [2] in the bibliography for details about linear prediction.
Coefficients Vector of
elements Vector containing the initialfilter coefficients. It must be a lengthlvector wherelis the
number of filter coefficients.
coeffsdefaults to lengthl
vector of zeros when you do not provide the argument for input.
FilterLength Any
positive integer
Reports the length of the filter, the number of coefficients or taps
ForgettingFactor Forgetting factor of the adaptive
filter. This is a scalar and should lie in the range (0, 1]. It defaults to 1. Setting
forgetting factor =1 denotes
infinite memory while adapting to find the new filter. Note that this is thelambdainput
adaptfilt.qrdlsl
Name Range Description
FwdPrediction Returns the predicted samples
generated during adaptation in the forward direction. Refer to [2] in the bibliography for details about linear prediction.
InitFactor Soft-constrained initialization
factor. This scalar should be positive and sufficiently large to prevent an excessive number of Kalman gain rescues. delta
defaults to one.
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 if you have not changed the filter since you constructed it.
PersistentMemoryreturns to
zero any state that the filter changes during processing. States that the filter does not change are not affected. Defaults tofalse.
States Vector of
elements, data type double
Vector of the adaptive filter states. statesdefaults to a
vector of zeros which has length equal tol -1
Examples
Implement Quadrature Phase Shift Keying (QPSK) adaptivethe equalization process in this example, look at the figure that follows the example code.
D = 16; % Number of samples of delay
b = exp(j*pi/4)*[-0.7 1]; % Numerator coefficients of channel
a = [1 -0.7]; % Denominator coefficients of channel
ntr= 1000; % Number of iterations
s = sign(randn(1,ntr+D))+j*sign(randn(1,ntr+D)); % Baseband QPSK signal
n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D)); % Noise signal
r = filter(b,a,s)+n; % Received signal
x = r(1+D:ntr+D); % Input signal (received signal)
d = s(1:ntr); % Desired signal (delayed QPSK signal)
lam = 0.995; % Forgetting factor
del = 1; % Soft-constrained initialization factor