# lineareq

(To be removed) Construct linear equalizer object

lineareq will be removed in a future release. Use `comm.LinearEqualizer` instead.

## Syntax

```eqobj = lineareq(nweights,alg) eqobj = lineareq(nweights,alg,sigconst) eqobj = lineareq(nweights,alg,sigconst,nsamp) ```

## Description

The `lineareq` function creates an equalizer object that you can use with the `equalize` function to equalize a signal. To learn more about the process for equalizing a signal, see Equalization.

`eqobj = lineareq(nweights,alg)` constructs a symbol-spaced linear equalizer object. The equalizer has `nweights` complex weights, which are initially all zeros. `alg` describes the adaptive algorithm that the equalizer uses; you should create `alg` using any of these functions: `lms`, `signlms`, `normlms`, `varlms`, `rls`, or `cma`. The signal constellation of the desired output is ```[-1 1]```, which corresponds to binary phase shift keying (BPSK).

`eqobj = lineareq(nweights,alg,sigconst)` specifies the signal constellation vector of the desired output.

`eqobj = lineareq(nweights,alg,sigconst,nsamp)` constructs a fractionally spaced linear equalizer object. The equalizer has `nweights` complex weights spaced at `T/nsamp`, where `T` is the symbol period and `nsamp` is a positive integer. `nsamp = 1` corresponds to a symbol-spaced equalizer.

### Properties

The table below describes the properties of the linear equalizer object. To learn how to view or change the values of a linear equalizer object, see Equalization.

Tip

To initialize or reset the equalizer object `eqobj`, enter `reset(eqobj)`.

PropertyDescription
`EqType`Fixed value, `'Linear Equalizer'`
`AlgType`Name of the adaptive algorithm represented by `alg`
`nWeights`Number of weights
`nSampPerSym`Number of input samples per symbol (equivalent to `nsamp` input argument). This value relates to both the equalizer structure (see the use of K in Equalization) and an assumption about the signal to be equalized.
`RefTap` (except for CMA equalizers)Reference tap index, between 1 and `nWeights`. Setting this to a value greater than 1 effectively delays the reference signal and the output signal by `RefTap-1` with respect to the equalizer's input signal.
`SigConst`Signal constellation, a vector whose length is typically a power of 2
`Weights`Vector of complex coefficients. This is the set of wi values in the schematic in Equalization.
`WeightInputs`Vector of tap weight inputs. This is the set of ui values in the schematic in Equalization.
`ResetBeforeFiltering`If `1`, each call to `equalize` resets the state of `eqobj` before equalizing. If `0`, the equalization process maintains continuity from one call to the next.
`NumSamplesProcessed`Number of samples the equalizer processed since the last reset. When you create or reset `eqobj`, this property value is `0`.
Properties specific to the adaptive algorithm represented by `alg`See reference page for the adaptive algorithm function that created `alg`: `lms`, `signlms`, `normlms`, `varlms`, `rls`, or `cma`.

### Relationships Among Properties

If you change `nWeights`, MATLAB maintains consistency in the equalizer object by adjusting the values of the properties listed below.

`Weights``zeros(1,nWeights)`
`WeightInputs``zeros(1,nWeights)`
`StepSize` (Variable-step-size LMS equalizers)`InitStep*ones(1,nWeights)`
`InvCorrMatrix` (RLS equalizers)`InvCorrInit*eye(nWeights)`

## 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,x(1:100)); yNew = eqNew(r,x(1:100));```

Use RLS Algorithm with Linear Equalizer

Configure `lineareq` and `comm.LinearEqualizer` objects with comparable settings.

`eqOld = lineareq(5,rls(0.95),pskmod(0:3,4,pi/4))`
```eqOld = EqType: 'Linear Equalizer' AlgType: 'RLS' nWeights: 5 nSampPerSym: 1 RefTap: 1 SigConst: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i] InvCorrInit: 0.1000 InvCorrMatrix: [5×5 double] Weights: [0 0 0 0 0] WeightInputs: [0 0 0 0 0] ResetBeforeFiltering: 1 NumSamplesProcessed: 0 ```
```eqNew = comm.LinearEqualizer('NumTaps',5,'Algorithm','RLS', ... 'ForgettingFactor',0.95,'Constellation',pskmod(0:3,4,pi/4),'ReferenceTap',1) ```
```eqNew = comm.LinearEqualizer with properties: Algorithm: 'RLS' NumTaps: 5 ForgettingFactor: 0.9500 InitialInverseCorrelationMatrix: 0.1000 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. 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));```

Configure `lineareq` and `comm.LinearEqualizer` objects with comparable settings. For the `comm.LinearEqualizer` object, set the initial inverse correlation matrix to `eye(5)*0.2`.

`eqOld = lineareq(5,rls(0.95),pskmod(0:3,4,pi/4))`
```eqOld = EqType: 'Linear Equalizer' AlgType: 'RLS' nWeights: 5 nSampPerSym: 1 RefTap: 1 SigConst: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i] ForgetFactor: 0.9500 InvCorrInit: 0.1000 InvCorrMatrix: [5×5 double] Weights: [0 0 0 0 0] WeightInputs: [0 0 0 0 0] ResetBeforeFiltering: 1 NumSamplesProcessed: 0 ```
```eqNew = comm.LinearEqualizer('NumTaps',5,'Algorithm','RLS', ... 'ForgettingFactor',0.95,'Constellation',pskmod(0:3,4,pi/4),'ReferenceTap',1, ... 'InitialInverseCorrelationMatrix',eye(5)*0.2) ```
```eqNew = comm.LinearEqualizer with properties: Algorithm: 'RLS' NumTaps: 5 ForgettingFactor: 0.9500 InitialInverseCorrelationMatrix: [5×5 double] 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. 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));```

Use CMA Algorithm with Linear Equalizer

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

`eqOld = lineareq(5,cma(0.05),pskmod(0:3,4,pi/4))`
```eqOld = EqType: 'Linear Equalizer' AlgType: 'Constant Modulus' nWeights: 5 nSampPerSym: 1 SigConst: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i] StepSize: 0.0500 LeakageFactor: 1 Weights: [1 0 0 0 0] WeightInputs: [0 0 0 0 0] ResetBeforeFiltering: 1 NumSamplesProcessed: 0 ```
```eqNew = comm.LinearEqualizer('NumTaps',5,'Algorithm','CMA','StepSize',0.05, ... 'Constellation',pskmod(0:3,4,pi/4),'ReferenceTap',1)```
```eqNew = comm.LinearEqualizer with properties: Algorithm: 'CMA' NumTaps: 5 StepSize: 0.0500 Constellation: [0.7071 + 0.7071i -0.7071 + 0.7071i -0.7071 - 0.7071i 0.7071 - 0.7071i] ReferenceTap: 1 InputSamplesPerSymbol: 1 AdaptWeightsSource: 'Property' AdaptWeights: 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));```

## Compatibility Considerations

expand all

Warns starting in R2020a

### Topics

Introduced before R2006a