(To be removed) Construct least mean square (LMS) adaptive algorithm object
alg = lms(stepsize)
alg = lms(stepsize,leakagefactor)
lms function creates an adaptive algorithm object that you
can use with the
lineareq function or
dfe function to create an equalizer object. You can then use the
equalizer object with the
equalize function to equalize a
signal. To learn more about the process for equalizing a signal, see Equalization.
alg = lms(stepsize) constructs an adaptive
algorithm object based on the least mean square (LMS) algorithm with a step size of
alg = lms(stepsize,leakagefactor) sets the
leakage factor of the LMS algorithm.
leakagefactor must be between 0
and 1. A value of 1 corresponds to a conventional weight update algorithm, and a value
of 0 corresponds to a memoryless update algorithm.
The table below describes the properties of the LMS adaptive algorithm object. To learn how to view or change the values of an adaptive algorithm object, see Equalization.
|Fixed value, |
|LMS step size parameter, a nonnegative real number|
|LMS leakage factor, a real number between 0 and 1|
You can equalize a signal by using the
equalize function to apply an adaptive equalizer object to the signal. The
equalize function also updates the equalizer.
In typical applications, an equalizer begins by using a known sequence of transmitted symbols when adapting the equalizer weights. The known sequence, called a training sequence, enables the equalizer to gather information about the channel characteristics. After the equalizer finishes processing the training sequence, it adapts the equalizer weights in decision-directed mode using a detected version of the output signal. To use a training sequence when invoking the
equalize function, include the symbols of the training sequence as an input vector.
Note as an exception, that CMA equalizers do not use a training sequence. If an equalizer object is based on CMA, you should not include a training sequence as an input vector.
This code illustrates how to use equalize with a training sequence. The training sequence in this case is just the beginning of the transmitted message.
Set up parameters and signals.
M = 4; % Alphabet size for modulation msg = randi([0 M-1],1500,1); % Random message qpskMod = comm.QPSKModulator('PhaseOffset',0); modmsg = qpskMod(msg); % Modulate using QPSK. trainlen = 500; % Length of training sequence chan = [.986; .845; .237; .123+.31i]; % Channel coefficients filtmsg = filter(chan,1,modmsg); % Introduce channel distortion.
Equalize the received signal.
eq1 = lineareq(8, lms(0.01)); % Create an equalizer object. eq1.SigConst = qpskMod((0:M-1)')'; % Set signal constellation. [symbolest,yd] = equalize(eq1,filtmsg,modmsg(1:trainlen)); % Equalize.
Compute error rates with and without equalization
Determine the number of errors that occurred in trying to recover the modulated message with and without the equalizer. The symbol error rates show that the equalizer improves the performance significantly.
qpskDemod = comm.QPSKDemodulator('PhaseOffset',0); demodmsg_noeq = qpskDemod(filtmsg); % Demodulate unequalized signal. demodmsg = qpskDemod(yd); % Demodulate detected signal from equalizer. errorCalc = comm.ErrorRate; % ErrorRate calculator ser_noEq = errorCalc(msg(trainlen+1:end), demodmsg_noeq(trainlen+1:end)); reset(errorCalc) ser_Eq = errorCalc(msg(trainlen+1:end),demodmsg(trainlen+1:end)); disp('Symbol error rates with and without equalizer:')
Symbol error rates with and without equalizer:
Plot the signals
Create a scatter plot showing the signal before and after equalization, as well as the reference signal constellation for QPSK modulation. The points of the equalized signal are clustered more closely around the points of the reference signal constellation, indicating the signal improvement from equalization.
h = scatterplot(filtmsg,1,trainlen,'bx'); hold on; scatterplot(symbolest,1,trainlen,'g.',h); scatterplot(eq1.SigConst,1,0,'k*',h); legend('Filtered signal','Equalized signal',... 'Ideal signal constellation'); hold off;
For more examples that use training sequences, see Adaptive Equalization.
If you invoke
equalize multiple times with the same equalizer object to equalize a series of signal vectors, you might use a training sequence the first time you call the function and omit the training sequence in subsequent calls. Each iteration of the
equalize function after the first one operates completely in decision-directed mode. However, because the
ResetBeforeFiltering property of the equalizer object is set to
equalize function uses the existing state information in the equalizer object when starting equalization operation for each iteration. As a result, the training affects all equalization operations, not just the first.
Notice in this code that the first call to
equalize uses a training sequence as an input argument, and the second call to equalize omits a training sequence.
Set up the signal transmission
Create a signal, QPSK modulate it, then filter it through a distortion channel.
M = 4; % Alphabet size for modulation msg = randi([0 M-1],1500,1); % Random message qpskMod = comm.QPSKModulator('PhaseOffset',0); modmsg = qpskMod(msg); % Modulate using QPSK chan = [.986; .845; .237; .123+.31i]; % Channel coefficients filtmsg = filter(chan,1,modmsg); % Introduce channel distortion
Set up equalizer
Specify equalizer parameters and create an lms equalizer object
trainlen = 500; % Length of training sequence eqlms = lineareq(8, lms(0.01)); % Create an equalizer object eqlms.SigConst = qpskMod((0:M-1)')'; % Set signal constellation parameter in the equalizer
Maintain continuity between calls to equalize.
eqlms.ResetBeforeFiltering = 0;
Equalize the received signal in pieces
Process the training sequence.
s1 = equalize(eqlms,filtmsg(1:trainlen),modmsg(1:trainlen));
Process some of the data in decision-directed mode.
s2 = equalize(eqlms,filtmsg(trainlen+1:800));
Process the rest of the data in decision-directed mode.
s3 = equalize(eqlms,filtmsg(801:end));
Concatenate the signal segments to get the full output of equalizer.
s = [s1; s2; s3];
Referring to the schematics presented in Equalization, define w as the vector of all weights wi and define u as the vector of all inputs ui. Based on the current set of weights, w, this adaptive algorithm creates the new set of weights given by
LeakageFactor) w + (
where the * operator denotes the complex conjugate.
 Farhang-Boroujeny, B., Adaptive Filters: Theory and Applications, Chichester, England, John Wiley & Sons, 1998.
 Haykin, Simon, Adaptive Filter Theory, Third Ed., Upper Saddle River, NJ, Prentice-Hall, 1996.
 Kurzweil, Jack, An Introduction to Digital Communications, New York, John Wiley & Sons, 2000.
 Proakis, John G., Digital Communications, Fourth Ed., New York, McGraw-Hill, 2001.