Main Content

mlseeq

Equalize linearly modulated signal using MLSE

Description

y = mlseeq(x,chcffs,const,tblen,opmode) equalizes the baseband signal vector x using the maximum likelihood sequence estimation (MLSE). chcffs provides estimated channel coefficients. const provides the ideal signal constellation points. tblen specifies the traceback depth. opmode specifies the operation mode of the equalizer. MLSE is implemented using the Viterbi Algorithm.

example

y = mlseeq(___,nsamp) specifies the number of samples per symbol in x, in addition to arguments in the previous syntax.

example

y = mlseeq(___,nsamp,preamble,postamble) specifies the number of samples per symbol in x, preamble, and postamble, in addition to arguments in the first syntax. This syntax applies when opmode is 'rst' only. For more information, see Preamble and Postamble in Reset Operation Mode.

y = mlseeq(___,nsamp,init_metric,init_states,init_inputs)specifies the number of samples per symbol in x, initial likelihood state metrics, initial traceback states, and initial traceback inputs for the equalizer, in addition to arguments in the first syntax. These three inputs are typically the final_metric, final_states, and final_inputs outputs from a previous call to this function. This syntax applies when opmode is 'cont' only. For more information, see Initialization in Continuous Operation Mode.

example

[y,final_metric,final_states,final_inputs] = mlseeq(___) returns the normalized final likelihood state metrics, final traceback states, and final traceback inputs at the end of the traceback decoding process, using any of the previous input argument syntaxes. This syntax applies when opmode is 'cont' only. For more information, see Initialization in Continuous Operation Mode.

Examples

collapse all

Use the reset operating mode of the mlseeq equalizer. Demodulate the signal and check the bit error rate.

Specify the modulation order, equalizer traceback depth, number of samples per symbol, and message length.

M = 2;
tblen =  10; 
nsamp = 2;
msgLen = 1000;

Generate the reference constellation.

const = pammod([0:M-1],M);

Generate a message with random data. Modulate and upsample the signal.

msgData = randi([0 M-1],msgLen,1); 
msgSym = pammod(msgData,M);
msgSymUp = upsample(msgSym,nsamp); 

Filter the data through a distortion channel and add Gaussian noise to the signal.

chanest = [0.986; 0.845; 0.237; 0.12345+0.31i]; 
msgFilt = filter(chanest,1,msgSymUp); 
msgRx = awgn(msgFilt,5,'measured');

Equalize and then demodulate the signal to recover the message. To initialize the equalizer, provide the channel estimate, reference constellation, equalizer traceback depth, number of samples per symbol, and set the operating mode to reset. Check the message bit error rate. Your results might vary because this example uses random numbers.

eqSym = mlseeq(msgRx,chanest,const,tblen,'rst',nsamp);
eqMsg = pamdemod(eqSym,M);

[nerrs ber] = biterr(msgData, eqMsg)
nerrs = 0
ber = 0

Recover a message that includes a preamble, equalize the signal, and check the symbol error rate.

Specify the modulation order, equalizer traceback depth, number of samples per symbol, preamble, and message length.

M = 4; 
tblen = 16;
nsamp = 1;
preamble = [3;1];
msgLen = 500;

Generate the reference constellation.

const = pskmod(0:3,4);

Generate a message by using random data and prepend the preamble to the message. Modulate the random data.

msgData = randi([0 M-1],msgLen,1);
msgData = [preamble; msgData];
msgSym = pskmod(msgData,M);

Filter the data through a distortion channel and add Gaussian noise to the signal.

chcoeffs = [0.623; 0.489+0.234i; 0.398i; 0.21];
chanest = chcoeffs;
msgFilt = filter(chcoeffs,1,msgSym);
msgRx = awgn(msgFilt,9,'measured');

Equalize the received signal. To configure the equalizer, provide the channel estimate, reference constellation, equalizer traceback depth, operating mode, number of samples per symbol, and preamble. The same preamble symbols appear at the beginning of the message vector and in the syntax for mlseeq. Because the system does not use a postamble, an empty vector is specified as the last input argument in this mlseeq syntax.

Check the symbol error rate of the equalized signal. Run-to-run results vary due to use of random numbers.

eqSym = mlseeq(msgRx,chanest,const,tblen,'rst',nsamp,preamble,[]);
[nsymerrs,ser] = symerr(msgSym,eqSym)
nsymerrs = 7
ser = 0.0139

Use the continuous operating mode of the mlseeq equalizer. Demodulate received signal packets and check the symbol error statistics.

Specify the modulation order, equalizer traceback depth, number of samples per symbol, message length, and number of packets to process.

M = 4;
tblen =  10; 
nsamp = 1;
msgLen = 1000; 
numPkts = 25;

Generate the reference constellation.

const = pskmod(0:M-1,M);

Set the initial input parameters for the metric, states, and inputs of the equalizer to empty vectors. These initial assignments represent the parameters for the first packet transmitted.

eq_metric = [];
eq_states = [];
eq_inputs = [];

Assign variables for symbol error statistics.

ttlSymbErrs = 0;
aggrPktSER = 0;

Send and receive multiple message packets in a simulation loop. Between the packet transmission and reception filter each packet through a distortion channel and add Gaussian noise.

for jj = 1:numPkts

Generate a message with random data. Modulate the signal.

    msgData = randi([0 M-1],msgLen,1); 
    msgMod = pskmod(msgData,M); 

Filter the data through a distortion channel and add Gaussian noise to the signal.

    chanest = [.986; .845; .237; .12345+.31i]; 
    msgFilt = filter(chanest,1,msgMod);
    msgRx = awgn(msgFilt,10,'measured');

Equalize the received symbols. To configure the equalizer, provide the channel estimate, reference constellation, equalizer traceback depth, operating mode, number of samples per symbol, and the equalizer initialization information. Continuous operating mode is specified for the equalizer. In continuous operating mode, the equalizer initialization information (metric, states, and inputs) are returned and used as inputs in the next iteration of the for loop.

    [eqSym,eq_metric,eq_states,eq_inputs] = ...
        mlseeq(msgRx,chanest,const,tblen,'cont',nsamp, ...
        eq_metric,eq_states,eq_inputs);

Save the symbol error statistics. Update the symbol error statistics with the aggregate results. Display the total number of errors. Your results might vary because this example uses random numbers.

    [nsymerrs,ser] = symerr(msgMod(1:end-tblen),eqSym(tblen+1:end));
    ttlSymbErrs = ttlSymbErrs + nsymerrs;
    aggrPktSER = aggrPktSER + ser;
end
printTtlErr = 'A total of %d symbol errors over the %d packets received.\n';
fprintf(printTtlErr,ttlSymbErrs,numPkts);
A total of 167 symbol errors over the 25 packets received.

Display the aggregate symbol error rate.

printAggrSER = 'The aggregate symbol error rate was %6.5d.\n';
fprintf(printAggrSER,aggrPktSER/numPkts);
The aggregate symbol error rate was 6.74747e-03.

Input Arguments

collapse all

Input signal, specified as a vector of modulated symbols. The vector length of x must be an integer multiple of nsamp.

Data Types: double
Complex Number Support: Yes

Channel coefficients, specified as a vector. The channel coefficients provide an estimate of the channel response. When nsamp > 1, the chcffs input specifies the oversampled channel coefficients.

Data Types: double
Complex Number Support: Yes

Reference constellation, specified as a vector with M elements. M is the modulation order. const lists the ideal signal constellation points in the sequence used by the modulator.

Data Types: double
Complex Number Support: Yes

Traceback depth, specified as a positive integer. The equalizer traces back from the likelihood state with the maximum metric.

Data Types: double

Operation mode, specified as 'rst' or 'cont'.

ValueUsage
'rst'

Run equalizer using reset operating mode. Enables you to specify a preamble and postamble that accompany the input signal. The function processes the input signal, x, independently of the input signal from any other invocations of this function. This operating mode does not incur an output delay. For more information, see Preamble and Postamble in Reset Operation Mode.

'cont'

Run equalizer using continuous operating mode. Enables you to save the internal state information of the equalizer for use in a subsequent invocation of this function. Continuous operating mode is useful if the input signal is partitioned into a stream of packets processed within a loop. This operating mode incurs an output delay of tblen symbols. For more information, see Initialization in Continuous Operation Mode.

Data Types: char

Number of samples per symbol, specified as a positive integer. nsamp is the oversampling factor.

Dependencies

The input signal, x, must be an integer multiple of nsamp.

Data Types: double

Input signal preamble, specified as a vector of integers between 0 and M–1, where M is the modulation order. To omit a preamble, specify [].

For more information, see Preamble and Postamble in Reset Operation Mode.

Dependencies

This input argument applies only when opmode is set to 'rst'.

Data Types: double

Input signal postamble, specified as a vector of integers between 0 and M–1, where M is the modulation order. To omit a postamble, specify [].

For more information, see Preamble and Postamble in Reset Operation Mode.

Dependencies

This input argument applies only when opmode is set to 'rst'.

Data Types: double

Initial state metrics, specified as a column vector with Nstates elements. For the description of Nstates, see Number of Likelihood States.

For more information, see Initialization in Continuous Operation Mode.

Dependencies

This input argument applies only when opmode is set to 'cont'. If specifying [] for init_metric, you must also specify [] for init_states and init_inputs.

Data Types: double

Initial traceback states, specified as an Nstates-by-tblen matrix of integers with values between 0 and Nstates–1. For the description of Nstates, see Number of Likelihood States.

For more information, see Initialization in Continuous Operation Mode.

Dependencies

This input argument applies only when opmode is set to 'cont'. If specifying [] for init_states, you must also specify [] for init_metric and init_inputs.

Data Types: double

Initial traceback inputs, specified as an Nstates-by-tblen matrix of integers with values between 0 and M–1. For the description of Nstates, see Number of Likelihood States.

For more information, see Initialization in Continuous Operation Mode.

Dependencies

This input argument applies only when opmode is set to 'cont'. If specifying [] for init_inputs, you must also specify [] for init_metric and init_states.

Data Types: double

Output Arguments

collapse all

Output signal, returned as a vector of modulated symbols.

Final normalized state metrics, returned as a vector with Nstates elements. final_metric corresponds to the final state metrics at the end of the traceback decoding process. For the description of Nstates, see Number of Likelihood States.

For more information, see Initialization in Continuous Operation Mode.

Final traceback states, returned as a Nstates-by-tblen matrix of integers with values between 0 and Nstates–1. final_states corresponds to the final traceback states at the end of the traceback decoding process. For the description of Nstates, see Number of Likelihood States.

For more information, see Initialization in Continuous Operation Mode.

Final traceback inputs, returned as an Nstates-by-tblen matrix of integers with values between 0 and M–1. final_inputs corresponds to the final traceback inputs at the end of the traceback decoding process. M is the order of the modulation. For the description of Nstates, see Number of Likelihood States.

For more information, see Initialization in Continuous Operation Mode.

More About

collapse all

Viterbi Algorithm

The Viterbi algorithm is a sequential trellis search algorithm used to perform maximum likelihood sequence detection.

The MLSE equalizer uses the Viterbi algorithm to recursively search for the sequences that maximize the likelihood function. Using the Viterbi algorithm reduces the number of sequences in the trellis search by eliminating sequences as new data is received. The metric used to determine the maximum likelihood sequence is the correlation between the received signal and an estimated signal for each received symbol over the Number of Likelihood States.

For more information, see [1] and [2].

Preamble and Postamble in Reset Operation Mode

When operating the MLSE equalizer in reset mode, you can specify a preamble and postamble as input arguments. Specify preamble and postamble as vectors equal to the preamble and postamble that are prepended and appended, respectively, to the input signal. The preamble and postamble vectors consist of integers between 0 and M-1, where M is the number of elements in const. To omit the preamble or postamble input argument, specify [].

When the function applies the Viterbi algorithm, it initializes state metrics in a way that depends on whether you specify a preamble, a postamble, or both:

  • If preamble is nonempty, the function decodes the preamble and assigns a metric of 0 to the decoded state. If the preamble does not decode to a unique state (that is, if the length of the preamble is less than the channel memory), the decoder assigns a metric of 0 to all states that are represented by the preamble. The traceback path ends at one of the states represented by the preamble.

  • If preamble is [], the decoder initializes the metrics of all states to 0.

  • If postamble is nonempty, the traceback path begins at the smallest of all possible decoded states that are represented by the postamble.

  • If postamble is [], the traceback path starts at the state with the smallest metric.

Initialization in Continuous Operation Mode

When operating the MLSE equalizer in continuous mode, you can initialize the equalization based on values returned in the previous call of the function.

At the end of the traceback decoding process, the function returns final_metric, final_states, and final_inputs. When opmode is 'cont', assign these outputs to init_metric, init_states, and init_inputs, respectively for the next call of the function. These assignments initialize the equalizer to start with the final state metrics, final traceback states, and final traceback inputs from the previous call of the function.

Each real number in init_metric represents the starting state metric of the corresponding state. init_states and init_inputs jointly specify the initial traceback memory of the equalizer.

Output ArgumentInput ArgumentMeaningMatrix SizeRange of Values
final_metricinit_metricState metrics1-by-NstatesReal numbers
final_statesinit_statesTraceback statesNstates-by-tblenIntegers between 0 and Nstates–1
fianl_inputsinit_inputsTraceback inputsNstates-by-tblenIntegers between 0 and M–1

To use default values for init_metric, init_states, and init_inputs, specify each as []. For the description of Nstates, see Number of Likelihood States.

Number of Likelihood States

The number of likelihood states, Nstates, is the number of correlative phase states in the trellis. Nstates is equal to ML-1, where M is the number of elements in const and L is the number of symbols in the nonoversampled impulse response of the channel.

References

[1] Proakis, John G. Digital Communications, Fourth Edition. New York: McGraw-Hill, 2001.

[2] Steele, Raymond, Ed. Mobile Radio Communications. Chichester, England: John Wiley & Sons, 1996.

Version History

Introduced before R2006a