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
EqTypeFixed value, 'Linear Equalizer'
AlgTypeName of the adaptive algorithm represented by alg
nWeightsNumber of weights
nSampPerSymNumber 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.
SigConstSignal constellation, a vector whose length is typically a power of 2
WeightsVector of complex coefficients. This is the set of wi values in the schematic in Equalization.
WeightInputsVector of tap weight inputs. This is the set of ui values in the schematic in Equalization.
ResetBeforeFilteringIf 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.
NumSamplesProcessedNumber 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 algSee 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.

PropertyAdjusted Value
Weightszeros(1,nWeights)
WeightInputszeros(1,nWeights)
StepSize (Variable-step-size LMS equalizers)InitStep*ones(1,nWeights)
InvCorrMatrix (RLS equalizers)InvCorrInit*eye(nWeights)

Examples

collapse all

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:
disp([ser_Eq(1) ser_noEq(1)]) 
         0    0.3230

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 0, the 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]; 

Compatibility Considerations

lineareq will be removed

lineareq will be removed. Use comm.LinearEqualizer instead.

Introduced before R2006a