mlseeq
Equalize linearly modulated signal using MLSE
Syntax
Description
equalizes the baseband signal vector y
= mlseeq(x
,chcffs
,const
,tblen
,opmode
)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.
specifies
the number of samples per symbol in y
= mlseeq(___,nsamp
,init_metric
,init_states
,init_inputs
)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.
[
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 y
,final_metric
,final_states
,final_inputs
] = mlseeq(___)opmode
is
'cont'
only. For more information, see Initialization in Continuous Operation Mode.
Examples
Using MLSE Equalizer Reset Operating Mode
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:M1],M);
Generate a message with random data. Modulate and upsample the signal.
msgData = randi([0 M1],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 = 1
ber = 1.0000e03
Recover Message Containing Preamble
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 M1],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. Runtorun results vary due to use of random numbers.
eqSym = mlseeq(msgRx,chanest,const,tblen,'rst',nsamp,preamble,[]);
[nsymerrs,ser] = symerr(msgSym,eqSym)
nsymerrs = 8
ser = 0.0159
Using MLSE Equalizer Continuous Operating Mode
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:M1,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 M1],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:endtblen),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 172 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.94949e03.
Input Arguments
x
— Input signal
vector
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
chcffs
— Channel coefficients
vector
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
const
— Reference constellation
vector
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
tblen
— Traceback depth
positive integer
Traceback depth, specified as a positive integer. The equalizer traces back from the likelihood state with the maximum metric.
Data Types: double
opmode
— Operation mode
'rst'
 'cont'
Operation mode, specified as 'rst'
or
'cont'
.
Value  Usage 

'rst'  Run equalizer using reset operating mode. Enables you to specify a

'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 
Data Types: char
nsamp
— Number of samples per symbol
1
(default)  positive integer
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
preamble
— Input signal preamble
vector of integers
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
postamble
— Input signal postamble
vector of integers
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
init_metric
— Initial state metrics
[ ] (default)  column vector
Initial state metrics, specified as a column vector with N_{states} elements. For the description of N_{states}, 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
init_states
— Initial traceback states
[ ] (default)  matrix of integers
Initial traceback states, specified as an
N_{states}bytblen
matrix
of integers with values between 0 and
N_{states}–1. For the description of
N_{states}, 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
init_inputs
— Initial traceback inputs
[]
(default)  matrix of integers
Initial traceback inputs, specified as an
N_{states}bytblen
matrix
of integers with values between 0 and M–1. For the description of
N_{states}, 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
y
— Output signal
vector
Output signal, returned as a vector of modulated symbols.
final_metric
— Final normalized state metrics
vector
Final normalized state metrics, returned as a vector with
N_{states} elements.
final_metric
corresponds to the final state metrics at the end of
the traceback decoding process. For the description of
N_{states}, see Number of Likelihood States.
For more information, see Initialization in Continuous Operation Mode.
final_states
— Final traceback states
vector
Final traceback states, returned as a
N_{states}bytblen
matrix
of integers with values between 0 and
N_{states}–1. final_states
corresponds to the final traceback states at the end of the traceback decoding process.
For the description of N_{states}, see Number of Likelihood States.
For more information, see Initialization in Continuous Operation Mode.
final_inputs
— Final traceback inputs
vector
Final traceback inputs, returned as an
N_{states}bytblen
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 N_{states}, see Number of Likelihood States.
For more information, see Initialization in Continuous Operation Mode.
More About
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.
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
M1, 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 Argument  Input Argument  Meaning  Matrix Size  Range of Values 

final_metric  init_metric  State metrics  1byN_{states}  Real numbers 
final_states  init_states  Traceback states  N_{states}bytblen  Integers between 0 and N_{states}–1 
fianl_inputs  init_inputs  Traceback inputs  N_{states}bytblen  Integers between 0 and M–1 
To use default values for init_metric
,
init_states
, and init_inputs
, specify each as
[]
. For the description of
N_{states}, see Number of Likelihood States.
Number of Likelihood States
The number of likelihood states,
N_{states}, is the number of correlative phase
states in the trellis. N_{states} is equal to
M^{L1}, 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: McGrawHill, 2001.
[2] Steele, Raymond, Ed. Mobile Radio Communications. Chichester, England: John Wiley & Sons, 1996.
Version History
Introduced before R2006a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)