Products & Services Industries Academia Support User Community Company

Learn more about Communications Blockset   

Communications Sources

Section Overview

Every communication system contains one or more sources. You can find sources in the Simulink Sources library, in the Signal Processing Sources library, and in the Communications Blockset's Comm Sources library.

You can open the Comm Sources library by double-clicking its icon in the main Communications Blockset library.

Blocks in the Comm Sources library can

This section describes these capabilities, considering first random and then nonrandom signals.

Random Data Sources

Blocks in the Random Data Sources sublibrary of the Comm Sources library generate random data to simulate signal sources. You can use blocks in the Random Data Sources sublibrary to generate

In addition, you can use built-in Simulink blocks such as the Random Number block as a data source.

You can open the Random Data Sources sublibrary by double-clicking its icon (found in the Comm Sources library of the main Communications Blockset library).

Random Bits

The Bernoulli Binary Generator block generates random bits and is suitable for representing sources. The block considers each element of the signal to be an independent Bernoulli random variable. Also, different elements need not be identically distributed.

Random Integers

The Random Integer Generator and Poisson Integer Generator blocks both generate vectors containing random nonnegative integers. The Random Integer Generator block uses a uniform distribution on a bounded range that you specify in the block mask. The Poisson Integer Generator block uses a Poisson distribution to determine its output. In particular, the output can include any nonnegative integer.

Random Noise Generators

Blocks in the Noise Generators sublibrary of the Comm Sources library generate random data to simulate channel noise. You can use blocks in the Noise Generators sublibrary to generate random real numbers, depending on what distribution you want to use. The choices are listed in the following table.

DistributionBlock
Gaussian Gaussian Noise Generator
Rayleigh Rayleigh Noise Generator
Rician Rician Noise Generator
Uniform on a bounded interval Uniform Noise Generator

You can open the Noise Generators sublibrary by double-clicking its icon in the main Communications Blockset library.

Sequence Generators

You can use blocks in the Sequence Generators sublibrary of the Communications Sources library to generate sequences for spreading or synchronization in a communication system. You can open the Sequence Generators sublibrary by double-clicking its icon in the main Communications Blockset library.

Blocks in the Sequence Generators sublibrary generate

Pseudorandom Sequences

The following table lists the blocks that generate pseudorandom or pseudonoise (PN) sequences. The applications of these sequences range from multiple-access spread spectrum communication systems to ranging, synchronization, and data scrambling.

SequenceBlock
Gold sequences Gold Sequence Generator
Kasami sequences Kasami Sequence Generator
PN sequences PN Sequence Generator

All three blocks use shift registers to generate pseudorandom sequences. The following is a schematic diagram of a typical shift register.

All r registers in the generator update their values at each time step according to the value of the incoming arrow to the shift register. The adders perform addition modulo 2. The shift register can be described by a binary polynomial in z, grzr + gr-1zr-1 + ... + g0. The coefficient gi is 1 if there is a connection from the ith shift register to the adder, and 0 otherwise.

The Kasami Sequence Generator block and the PN Sequence Generator block use this polynomial description for their Generator polynomial parameter, while the Gold Sequence Generator block uses it for the Preferred polynomial [1] and Preferred polynomial [2] parameters.

The lower half of the preceding diagram shows how the output sequence can be shifted by a positive integer d, by delaying the output for d units of time. This is accomplished by a single connection along the dth arrow in the lower half of the diagram.

See Pseudorandom Sequences for an example that uses these blocks.

Synchronization Codes

The Barker Code Generator block generates Barker codes to perform synchronization. Barker codes are subsets of PN sequences. They are short codes, with a length at most 13, which are low-correlation sidelobes. A correlation sidelobe is the correlation of a codeword with a time-shifted version of itself.

Orthogonal Codes

Orthogonal codes are used in systems in which the receiver is perfectly synchronized with the transmitter. For such systems, the despreading operation is ideal when orthogonal codes are used for the spreading. For example, they are used in the forward link of the IS-95 system, in which the base station transmits a pilot signal to help the receiver gain synchronization.

CodeBlock
Hadamard codes Hadamard Code Generator
OVSF codes OVSF Code Generator
Walsh codes Walsh Code Generator

See Orthogonal Sequences for an example that uses these blocks.

Sequence Generator Examples

This section presents two example models that illustrate the blocks in the Sequence Generators library.

Pseudorandom Sequences

This example describes the autocorrelation properties of the pseudorandom sequences generated by the following three blocks:

If you are reading this in the MATLAB Help Browser, click here to open the model.

The model displays the output sequences of the three blocks in a scope. All three blocks have the same Generator polynomial parameter, [1 0 0 0 0 1 1], whose digits are the coefficients of the polynomial x6 + x + 1. Since this polynomial has degree 6, the output sequence has period 26 - 1 = 63.

When you run the model, the scope displays two periods of data for each of the three signals, as in the following figure.

The model also sends the output sequences to the MATLAB workspace as the vectors pn, gold, and kas. You can verify the autocorrelation properties of the output of the PN Sequence Generator block by entering the following at the MATLAB prompt:

x = pn(1:63); % Take one period only.
x = 1 - 2.*x; % Convert to bipolar.
for i = 1:63  % Determine the cyclic autocorrelation.
    corrvec(i) = x' * [x(i:end); x(1:i-1)];
end
corrvals = unique(sort(corrvec)) % Choose the unique values.

This code calculates the cyclic autocorrelation of the PN sequence, by taking the inner product of one period of the sequence with each of its 63 cyclic rotations, and stores the results in a vector, corrvec, of length 63. The code then sorts the entries of corrvec and finds the unique autocorrelation values.

The result is

corrvals =
-1    63

The first entry of the vector corrvec is 63, while all other values are -1, as you can verify by entering corrvec at the MATLAB prompt. This means that 63 occurs only by taking the inner product of the sequence pn with an unrotated copy of itself. All other inner products have the value -1.

You can analyze the output sequences of the Gold Sequence Generator block and the Kasami Sequence Generator block similarly by changing the first line of the preceding code to

x = gold(1:63);

and

x = kas(1:63);

respectively.

For the Gold and Kasami sequences, the autocorrelation takes on three values. For example, the values for the Gold sequence are

corrvals =
-17    -1    15    63

The values for the Kasami sequence are

corrvals =
-9    -1     7    63

Of the three types of sequences, the PN sequences are best suited for synchronization because the autocorrelation takes on just two values. However, the Gold and Kasami sequences provide a larger number of sequences with good cross-correlation properties than do the PN sequences.

The peak value of corrvals for the Kasami sequence is less than the peak value for the Gold sequence. In fact, the small set of Kasami sequences satisfies the lower bounds for correlation values, and for this reason they are also referred to as optimal sequences.

Orthogonal Sequences

This example demonstrates the orthogonality of pairs of sequences generated using different Code index parameters, for each of the following three blocks:

If you are reading this in the MATLAB Help Browser, click here to open the model.

The model displays the output sequences of the three blocks in a scope. All three blocks output sequences of period 64, corresponding to their Code length parameters. When you run the model, the scope displays two periods of data for each sequence.

The following script runs the model twice, the first time with the Code index parameter of 60 for all three blocks, and the second time with a Code index of 30. The script then calculates, for each of the three blocks, the cross-correlation between the sequence generated by the first run and the sequence generated by the second run.

% Simulate once.
set_param('doc_ortho/Hadamard Code Generator', 'index', '60');
set_param('doc_ortho/Walsh Code Generator', 'index', '60');
set_param('doc_ortho/OVSF Code Generator', 'index', '60');
sim('doc_ortho');

% Store the codes.
had60 = had(1:64);
walsh60 = walsh(1:64);
ovsf60 = ovsf(1:64);

% Simulate again.
set_param('doc_ortho/Hadamard Code Generator', 'index', '31');
set_param('doc_ortho/Walsh Code Generator', 'index', '31');
set_param('doc_ortho/OVSF Code Generator', 'index', '31');
sim('doc_ortho');

% Store the codes.
had31 = had(1:64);
walsh31 = walsh(1:64);
ovsf31 = ovsf(1:64);

% Calculate the cross-correlation.
hadcorr = had60(1:64)'*had31(1:64);
hadcorr
walshcorr = walsh60(1:64)'*walsh31(1:64);
walshcorr
ovsfcorr = ovsf60(1:64)'*ovsf31(1:64);
ovsfcorr

The results are

haddcorr=
0
walshcorr =
0
ovsfcorr =
0

The results show that for each block, the sequence generated by the first run is orthogonal to the sequence generated by the second run.

Block Parameters

This section discusses the sample time parameter, seed parameter, and signal attribute parameters that are common to many random source blocks, and then discusses each category of random source.

Sample Time Parameter for Random Sources

Each of the random source blocks requires you to set a Sample time parameter in the block mask. If you configure the block to produce a sample-based signal, this parameter is the time interval between successive updates of the signal. If you configure the block to produce a frame-based matrix signal, the Sample time parameter is the time interval between successive rows of the frame-based matrix.

If you use a Simulink Probe block to query the period of a frame-based output from a random source block in the Comm Sources library, note that the Probe block reports the period of the entire frame, not the period of each sample in a given channel of the frame. The following equation relates the quantities involved for a single-channel signal:

A seconds/frame = (B seconds/sample)*(S samples/frame)

where

Seed Parameter

The blocks in the Communication Sources library that generate random data require you to set a seed in the block mask. This is the initial seed that the random number generator uses when forming its sequence of numbers. Make sure that initial seeds in different blocks in a model have different values, so that they generate statistically independent sequences.

Signal Attribute Parameters for Random Sources

In most random source blocks, the output can be a frame-based matrix, a sample-based row or column vector, or a sample-based one-dimensional array. The following table indicates how to set certain block parameters depending on the kind of signal you want to generate.

Signal AttributesParameter Settings
Sample-based, one-dimensional

Sample-based row vector

Also, any vector parameters in the block should be rows, not columns.

Sample-based column vector

Also, any vector parameters in the block should be columns, not rows.

Frame-based

Also, set Samples per frame to the number of samples in each output frame, that is, the number of rows in the signal.

The Frame-based outputs and Interpret vector parameters as 1-D check boxes are mutually exclusive, because frame-based signals and one-dimensional signals are mutually exclusive. The Samples per frame parameter field is active only if the Frame-based outputs check box is checked.

Example.   The model in the following figure illustrates that one random source block can produce various kinds of signals. The annotations in the model indicate how each copy of the block is configured. Each block's configuration affects the type of connector line (single or double) and the signal dimensions that appear above each connector line. In the case of the Rayleigh Noise Generator block, the first two block parameters (Sigma and Initial seed) determine the number of channels in the output; for analogous indicators in other random source blocks, see their individual reference entries.

The particular mask parameters depend on the block. See each block's reference page for details.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS