Main Content

Variable-Size Signal Support with System Objects

Several Communications Toolbox™ System objects support variable-size input signals. In these System objects, you can change the frame size (number of rows) of the input matrix even when the object is locked. The number of channels (number of columns) of the input matrix must remain constant. The System object™ locks when you call the object to run its algorithm. For System objects that do not support variable-size input signals, you must unlock the object to change the frame size.

For the list of System objects in Communications Toolbox that support variable-size signals, see Communications Toolbox System Objects with Variable-Size Signal Support. For a list of Communications Toolbox blocks that support variable-size signals, run the showcommblockdatatypetable function from the MATLAB® command prompt to open the block data type support table. See the blocks in rows with an X in the Variable-Size Support column of the block data type support table.

Show Variable-Size Signal Support

Vary the number of samples per frame to show the variable-size signal support of GMSK modulator, GSMK demodulator, AWGN channel, and error rate calculator System objects.

Create System objects. For the error rate calculator, account for the delay between the modulator and demodulator, caused by the Viterbi algorithm.

gmskmodulator = comm.GMSKModulator( ...
    BitInput=true, ...
    InitialPhaseOffset=pi/4);
gmskdemodulator = comm.GMSKDemodulator( ...
    BitOutput=true, ...
    InitialPhaseOffset=pi/4);
channel = comm.AWGNChannel( ...
    NoiseMethod='Signal to noise ratio (SNR)', ...
    SNR=0);
errorRate = comm.ErrorRate( ...
    ReceiveDelay=gmskdemodulator.TracebackDepth);

Process a frame of samples.

numSamp = 1e5;
data = randi([0 1],numSamp,1);
modSignal = gmskmodulator(data);
noisySignal = channel(modSignal);
receivedData = gmskdemodulator(noisySignal);
errorStats = errorRate(data,receivedData);

Display the error statistics.

fprintf(['Error rate = %f\nNumber of errors = %d' ...
    '\nNumber of samples = %d\n'], ...
    errorStats(1),errorStats(2),errorStats(3))
Error rate = 0.000120
Number of errors = 12
Number of samples = 99984

Adjust the frame size and process another frame of samples. The System objects run without error.

numSamp = 3e5;
data = randi([0 1],numSamp,1);
modSignal = gmskmodulator(data);
noisySignal = channel(modSignal);
receivedData = gmskdemodulator(noisySignal);
errorStats = errorRate(data,receivedData);

Display the error statistics.

fprintf(['Error rate = %f\nNumber of errors = %d' ...
    '\nNumber of samples = %d\n'], ...
    errorStats(1),errorStats(2),errorStats(3))
Error rate = 0.000115
Number of errors = 46
Number of samples = 399984

Communications Toolbox System Objects with Variable-Size Signal Support

Error Detection and Correction
comm.APPDecoder
comm.ConvolutionalEncoder
comm.TurboEncoder — Only when you set InterleaverIndicesSource to 'Input Port'.
comm.TurboDecoder — Only when you set InterleaverIndicesSource to 'Input Port'.
comm.ViterbiDecoder
Equalization
comm.DecisionFeedbackEqualizer — Only X input.
comm.LinearEqualizer — Only X input.
Synchronization and Receiver Design
comm.CarrierSynchronizer
comm.PreambleDetector

Related Topics