Main Content

varlms

(To be removed) Construct variable-step-size least mean square (LMS) adaptive algorithm object

varlms will be removed in a future release. Use comm.LinearEqualizer or comm.DecisionFeedback instead.

Syntax

alg = varlms(initstep,incstep,minstep,maxstep)

Description

The varlms 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 = varlms(initstep,incstep,minstep,maxstep) constructs an adaptive algorithm object based on the variable-step-size least mean square (LMS) algorithm. initstep is the initial value of the step size parameter. incstep is the increment by which the step size changes from iteration to iteration. minstep and maxstep are the limits between which the step size can vary.

Properties

The table below describes the properties of the variable-step-size LMS adaptive algorithm object. To learn how to view or change the values of an adaptive algorithm object, see Equalization.

PropertyDescription
AlgTypeFixed value, 'Variable Step Size LMS'
LeakageFactorLMS leakage factor, a real number between 0 and 1. A value of 1 corresponds to a conventional weight update algorithm, while a value of 0 corresponds to a memoryless update algorithm.
InitStepInitial value of step size when the algorithm starts
IncStepIncrement by which the step size changes from iteration to iteration
MinStepMinimum value of step size
MaxStepMaximum value of step size

Also, when you use this adaptive algorithm object to create an equalizer object (via the lineareq or dfe function), the equalizer object has a StepSize property. The property value is a vector that lists the current step size for each weight in the equalizer.

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 current weights wi and define u as the vector of all inputs ui. Based on the current step size, μ, this adaptive algorithm first computes the quantity

μ0 = μ + (IncStep) Re(ggprev)

where g = ue*, gprev is the analogous expression from the previous iteration, and the * operator denotes the complex conjugate.

Then the new step size is given by

  • μ0, if it is between MinStep and MaxStep

  • MinStep, if μ0 < MinStep

  • MaxStep, if μ0 > MaxStep

The new set of weights is given by

(LeakageFactor) w + 2 μ g*

Compatibility Considerations

expand all

Warns starting in R2020a

References

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

Introduced before R2006a