| Communications Toolbox | ![]() |
If your data is partitioned into a series of vectors (that you process within a loop, for example), then continuous operation mode is an appropriate way to use the mlseeq function. In continuous operation mode, mlseeq can save its internal state information for use in a subsequent invocation and can initialize using previously stored state information. To choose continuous operation mode, use 'cont' as an input argument when invoking mlseeq.
Note Continuous operation mode incurs a delay, as described in Delays in Continuous Operation Mode. Also, continuous operation mode cannot accommodate a preamble or postamble. |
The typical procedure for using continuous mode within a loop is as follows:
Before the loop starts, create three empty matrix variables (for example, sm, ts, ti) that will eventually store the state metrics, traceback states, and traceback inputs for the equalizer.
Inside the loop, invoke mlseeq using a syntax like
[y,sm,ts,ti] = mlseeq(x,chcoeffs,const,tblen,'cont',nsamp,sm,ts,ti);
Using sm, ts, and ti as input arguments causes mlseeq to continue from where it finished in the previous iteration. Using sm, ts, and ti as output arguments causes mlseeq to update the state information at the end of the current iteration. In the first iteration, sm, ts, and ti start as empty matrices, so the first invocation of the mlseeq function initializes the metrics of all states to 0.
Continuous operation mode with a traceback depth of tblen incurs an output delay of tblen symbols. This means that the first tblen output symbols are unrelated to the input signal, while the last tblen input symbols are unrelated to the output signal. For example, the command below uses a traceback depth of 3, and the first 3 output symbols are unrelated to the input signal of ones(1,10).
y = mlseeq(ones(1,10),1,[-7:2:7],3,'cont')
y =
-7 -7 -7 1 1 1 1 1 1 1
Keeping track of delays from different portions of a communication system is important, especially if you compare signals to compute error rates. The example in Example: Continuous Operation Mode illustrates how to take the delay into account when computing an error rate.
The example below illustrates the procedure for using continuous operation mode within a loop. Because the example is long, this discussion presents it in multiple steps:
Initializing Variables. The beginning of the example defines parameters, initializes the state variables sm, ts, and ti, and initializes variables that accumulate results from each iteration of the loop.
n = 200; % Number of symbols in each iteration numiter = 25; % Number of iterations M = 4; % Use 4-PSK modulation. const = pskmod(0:M-1,M); % PSK constellation chcoeffs = [1 ; 0.25]; % Channel coefficients chanest = chcoeffs; % Channel estimate tblen = 10; % Traceback depth for equalizer nsamp = 1; % Number of input samples per symbol sm = []; ts = []; ti = []; % Initialize equalizer data. % Initialize cumulative results. fullmodmsg = []; fullfiltmsg = []; fullrx = [];
Simulating the System Using a Loop. The middle portion of the example is a loop that generates random data, modulates it using baseband PSK modulation, and filters it. Finally, mlseeq equalizes the filtered data. The loop also updates the variables that accumulate results from each iteration of the loop.
for jj = 1:numiter
msg = randint(n,1,M); % Random signal vector
modmsg = pskmod(msg,M); % PSK-modulated signal
filtmsg = filter(chcoeffs,1,modmsg); % Filtered signal
% Equalize, initializing from where the last iteration
% finished, and remembering final data for the next iteration.
[rx sm ts ti] = mlseeq(filtmsg,chanest,const,tblen,...
'cont',nsamp,sm,ts,ti);
% Update vectors with cumulative results.
fullmodmsg = [fullmodmsg; modmsg];
fullfiltmsg = [fullfiltmsg; filtmsg];
fullrx = [fullrx; rx];
endComputing an Error Rate and Plotting Results.
The last portion of the example computes the symbol error rate from all iterations of the loop. Notice that the symerr function compares selected portions of the received and transmitted signals, not the entire signals. Because continuous operation mode incurs a delay whose length in samples is the traceback depth (tblen) of the equalizer, it is necessary to exclude the first tblen samples from the received signal and the last tblen samples from the transmitted signal. Excluding samples that represent the delay of the equalizer ensures that the symbol error rate calculation compares samples from the received and transmitted signals that are meaningful and that truly correspond to each other.
The example also plots the signal before and after equalization in a scatter plot. The points in the equalized signal coincide with the points of the ideal signal constellation for 4-PSK.
% Compute total number of symbol errors. Take the delay into account.
numsymerrs = symerr(fullrx(tblen+1:end),fullmodmsg(1:end-tblen))
% Plot signal before and after equalization.
h = scatterplot(fullfiltmsg); hold on;
scatterplot(fullrx,1,0,'r*',h);
legend('Filtered signal before equalization','Equalized signal',...
'Location','NorthOutside');
hold off;The output and plot are below.
numsymerrs =
0

| Equalizing a Vector Signal | Using a Preamble or Postamble | ![]() |
© 1994-2005 The MathWorks, Inc.