lms

(To be removed) Construct least mean square (LMS) adaptive algorithm object

lms will be removed in a future release. Use comm.LinearEqualizer or comm.DecisionFeedbackEqualizer instead.

Syntax

alg = lms(stepsize)
alg = lms(stepsize,leakagefactor)

Description

The 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 stepsize.

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.

Properties

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.

PropertyDescription
AlgTypeFixed value, 'LMS'
StepSizeLMS step size parameter, a nonnegative real number
LeakageFactorLMS leakage factor, a real number between 0 and 1

Examples

collapse all

This example configures the recommended comm.LinearEqualizer System object™ and the legacy lineareq feature with comparable settings.

Initialize Variables and Supporting Objects

d = randi([0 3],1000,1);
x = pskmod(d,4,pi/4);
r = awgn(x,25);
sps = 2; %samples per symbol for oversampled cases
nTaps = 6;
txFilter = comm.RaisedCosineTransmitFilter('FilterSpanInSymbols',nTaps, ...
    'OutputSamplesPerSymbol',4);
rxFilter = comm.RaisedCosineReceiveFilter('FilterSpanInSymbols',nTaps, ...
    'InputSamplesPerSymbol',4,'DecimationFactor',2);
x2 = txFilter(x);
r2 = rxFilter(awgn(x2,25,0.5));
filterDelay = txFilter.FilterSpanInSymbols/2 + ...
    rxFilter.FilterSpanInSymbols/2; % Total filter delay in symbols

To compare the equalized output, plot the constellations using code such as:

% plot(yNew,'*')
% hold on
% plot(yOld,'o')
% hold off; legend('New Eq','Old Eq'); grid on

Use LMS Algorithm with Linear Equalizer

Configure lineareq and comm.LinearEqualizer objects with comparable settings. The LeakageFactor property has been removed from LMS algorithm. The comm.LinearEqualizer System object™ assumes that leakage factor is always 1.

eqOld = lineareq(5,lms(0.05),pskmod(0:3,4,pi/4))
eqOld =
  EqType: 'Linear Equalizer'
  AlgType: 'LMS'
  nWeights: 5
  nSampPerSym: 1
  RefTap: 1
  SigConst: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i]
  StepSize: 0.0500
  LeakageFactor: 1
  Weights: [0 0 0 0 0]
  WeightInputs: [0 0 0 0 0]
  ResetBeforeFiltering: 1
  NumSamplesProcessed: 0
eqNew = comm.LinearEqualizer('NumTaps',5,'Algorithm','LMS','StepSize',0.05, ...
    'Constellation',pskmod(0:3,4,pi/4),'ReferenceTap',1)
eqNew = comm.LinearEqualizer with properties:
  Algorithm: 'LMS'
  NumTaps: 5
  StepSize: 0.0500
  Constellation: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i]
  ReferenceTap: 1
  InputDelay: 0
  InputSamplesPerSymbol: 1
  TrainingFlagInputPort: false
  AdaptAfterTraining: true
  InitialWeightsSource: 'Auto'
  WeightUpdatePeriod: 1

Call the equalizers.

yOld = equalize(eqOld,r);
yNew = eqNew(r);

Use Linear Equalizers Considering Signal Delays

Configure lineareq and comm.LinearEqualizer objects with comparable settings. The transmit and receive filters result in a signal delay between the transit and receive signals. Account for this delay by setting the RefTap property of the lineareq to a value close to the delay value in samples. Additionally, nWeights must be set to a value greater than RefTap.

eqOld = lineareq(filterDelay*sps+4,lms(0.01),pskmod(0:3,4,pi/4),sps);
eqOld.RefTap = filterDelay*sps+1 % Adjust to synchronize with delayed signal 
eqOld =
  EqType: 'Linear Equalizer'
  AlgType: 'LMS'
  nWeights: 16
  nSampPerSym: 2
  RefTap: 13
  SigConst: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i]
  StepSize: 0.0100
  LeakageFactor: 1
  Weights: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
  WeightInputs: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
  ResetBeforeFiltering: 1
  NumSamplesProcessed: 0

eqNew = comm.LinearEqualizer('NumTaps',16,'Algorithm','LMS','StepSize',0.01, ...
    'Constellation',pskmod(0:3,4,pi/4),'InputSamplesPerSymbol',sps, ...
    'ReferenceTap',filterDelay*sps+1,'InputDelay',0)
eqNew = comm.LinearEqualizer with properties:
  Algorithm: 'LMS'
  NumTaps: 16
  StepSize: 0.0100
  Constellation: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i]
  ReferenceTap: 13
  InputDelay: 0
  InputSamplesPerSymbol: 2
  TrainingFlagInputPort: false
  AdaptAfterTraining: true
  InitialWeightsSource: 'Auto'
  WeightUpdatePeriod: 1

Call the equalizers. When ResetBeforeFiltering is set to true, each call of the equalize object resets the equalizer. To get the equivalent behavior call reset after each call of the comm.LinearEqualizer object.

yOld1 = equalize(eqOld,r,x(1:100));
yOld2 = equalize(eqOld,r,x(1:100));

yNew1 = eqNew(r,x(1:100));
reset(eqNew)
yNew2 = eqNew(r,x(1:100));

In the comm.LinearEqualizer object, InputDelay is used to synchronize with the delayed signal. NumTaps and ReferenceTap are independent of delay value. We can reduce the number of taps by utilizing the InputDelay to synchronize instead of reference tap. Reducing the number of taps also reduces equalizer self noise.

eqNew = comm.LinearEqualizer('NumTaps',11,'Algorithm','LMS','StepSize',0.01, ...
    'Constellation',pskmod(0:3,4,pi/4),'InputSamplesPerSymbol',sps, ...
    'ReferenceTap',6,'InputDelay',filterDelay*sps)
eqNew = comm.LinearEqualizer with properties:
  Algorithm: 'LMS'
  NumTaps: 11
  StepSize: 0.0100
  Constellation: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i]
  ReferenceTap: 6
  InputDelay: 12
  InputSamplesPerSymbol: 2
  TrainingFlagInputPort: false
  AdaptAfterTraining: true
  InitialWeightsSource: 'Auto'
  WeightUpdatePeriod: 1

yNew1 = eqNew(r2,x(1:100));
reset(eqNew)
yNew2 = eqNew(r2,x(1:100));

Algorithms

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 + (StepSize) u*e

where the * operator denotes the complex conjugate.

Compatibility Considerations

expand all

Warns starting in R2020a

References

[1] Farhang-Boroujeny, B., Adaptive Filters: Theory and Applications, Chichester, England, John Wiley & Sons, 1998.

[2] Haykin, Simon, Adaptive Filter Theory, Third Ed., Upper Saddle River, NJ, Prentice-Hall, 1996.

[3] Kurzweil, Jack, An Introduction to Digital Communications, New York, John Wiley & Sons, 2000.

[4] Proakis, John G., Digital Communications, Fourth Ed., New York, McGraw-Hill, 2001.

Introduced before R2006a