equalize

(To be removed) Equalize signal using equalizer object

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

Syntax

y = equalize(eqobj,x)
y = equalize(eqobj,x,trainsig)
[y,yd] = equalize(...)
[y,yd,e] = equalize(...)

Description

y = equalize(eqobj,x) processes the baseband signal vector x with equalizer object eqobj and returns the equalized signal vector y. At the end of the process, eqobj contains updated state information such as equalizer weight values and input buffer values. To construct eqobj, use the lineareq or dfe function. The equalize function assumes that the signal x is sampled at nsamp samples per symbol, where nsamp is the value of the nSampPerSym property of eqobj. For adaptive algorithms other than CMA, the equalizer adapts in decision-directed mode using a detector specified by the SigConst property of eqobj. The delay of the equalizer is (eqobj.RefTap-1)/eqobj.nSampPerSym.

Note that (eqobj.RefTap-1) must be an integer multiple of nSampPerSym. For a fractionally-spaced equalizer, the taps are spaced at fractions of a symbol period. The reference tap pertains to training symbols, and thus, must coincide with a whole number of symbols (i.e., an integer number of samples per symbol). eqobj.RefTap=1 corresponds to the first symbol, eqobj.RefTap=nSampPerSym+1 to the second, and so on. Therefore (eqobj.RefTap-1) must be an integer multiple of nSampPerSym.

If eqobj.ResetBeforeFiltering is 0, equalize uses the existing state information in eqobj when starting the equalization operation. As a result, equalize(eqobj,[x1 x2]) is equivalent to [equalize(eqobj,x1) equalize(eqobj,x2)]. To reset eqobj manually, apply the reset function to eqobj.

If eqobj.ResetBeforeFiltering is 1, equalize resets eqobj before starting the equalization operation, overwriting any previous state information in eqobj.

y = equalize(eqobj,x,trainsig) initially uses a training sequence to adapt the equalizer. After processing the training sequence, the equalizer adapts in decision-directed mode. The vector length of trainsig must be less than or equal to length(x)-(eqobj.RefTap-1)/eqobj.nSampPerSym.

[y,yd] = equalize(...) returns the vector yd of detected data symbols.

[y,yd,e] = equalize(...) returns the result of the error calculation. For adaptive algorithms other than CMA, e is the vector of errors between y and the reference signal, where the reference signal consists of the training sequence or detected symbols.

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]; 

For proper equalization using adaptive algorithms other than CMA, you should set the reference tap so that it exceeds the delay, in symbols, between the transmitter's modulator output and the equalizer input. When this condition is satisfied, the total delay between the modulator output and the equalizer output is equal to (RefTap-1)/nSampPerSym symbols. Because the channel delay is typically unknown, a common practice is to set the reference tap to the center tap in a linear equalizer, or the center tap of the forward filter in a decision-feedback equalizer.

For CMA equalizers, the expression above does not apply because a CMA equalizer has no reference tap. If you need to know the delay, you can find it empirically after the equalizer weights have converged. Use the xcorr function to examine cross-correlations of the modulator output and the equalizer output.

Techniques for Working with Delays

Here are some typical ways to take a delay of D into account by padding or truncating data:

  • Pad your original data with D extra symbols at the end. Before comparing the original data with the received data, omit the first D symbols of the received data. In this approach, all the original data (not including the padding) is accounted for in the received data.

  • Before comparing the original data with the received data, omit the last D symbols of the original data and the first D symbols of the received data. In this approach, some of the original symbols are not accounted for in the received data.

This example illustrates the second approach by omitting the last D symbols to account for the delay. For an example that illustrates both approaches in the context of interleavers, see Delays of Convolutional Interleavers.

Create a random signal and BPSK modulate it. Assign a portion of the signal as a training signal.

M = 2; % Use BPSK modulation
msg = randi([0 M-1],1000,1); % Random data
bpskMod = comm.BPSKModulator('PhaseOffset',0);
modmsg = bpskMod(msg); % Modulate
trainlen = 100; % Length of training sequence
trainsig = modmsg(1:trainlen); % Training sequence

Define an equalizer and equalize the received signal.

eqlin = lineareq(3,normlms(.0005,.0001),pskmod(0:M-1,M));
eqlin.RefTap = 2; % Set reference tap of equalizer.
[eqsig,detsym] = equalize(eqlin,modmsg,trainsig); % Equalize.

Demodulate the detected signal.

bpskDemod = comm.BPSKDemodulator('PhaseOffset',0);
detmsg = bpskDemod(detsym);

Compute bit error rate while compensating for delay introduced by RefTap and ignoring training sequence.

D = (eqlin.RefTap-1)/eqlin.nSampPerSym;
hErrorCalc = comm.ErrorRate('ReceiveDelay',D);
berVec = step(hErrorCalc, msg(trainlen+1:end), detmsg(trainlen+1:end));
ber = berVec(1)
ber = 0
numerrs = berVec(2)
numerrs = 0

Compatibility Considerations

equalize will be removed

equalize will be removed. Use comm.LinearEqualizer or comm.DecisionFeedback instead.

Introduced before R2006a