Generate Kasami sequence
KasamiSequence object generates a sequence
from the set of Kasami sequences. The Kasami sequences are a set of
sequences that have good cross-correlation properties.
To generate a Kasami sequence:
Define and set up your Kasami sequence object. See Construction.
step to generate a Kasami
sequence according to the properties of
The behavior of
step is specific to each object in
Starting in R2016b, instead of using the
H = comm.KasamiSequence creates a KasamiSequence System object,
This object generates a Kasami sequence.
H = comm.KasamiSequence( creates
a Kasami sequence generator object,
H, with each
specified property set to the specified value. You can specify additional
name-value pair arguments in any order as (
Specify the polynomial that determines the shift register's
feedback connections. The default is
You can specify the generator polynomial as a character
vector or as a binary numeric vector that lists the coefficients
of the polynomial in descending order of powers. The first and last
elements must equal
Lastly, you can specify the generator polynomial as a vector
containing the exponents of z for the nonzero terms
of the polynomial in descending order of powers. The last entry must
Initial conditions of shift register
Specify the initial values of the shift register as a binary
numeric scalar or as binary numeric vector. The default is
When you set this property to a vector value, each element of the vector corresponds to the initial value of the corresponding cell in the shift register.
When you set this property to a scalar value, that value specifies the initial conditions of all the cells of the shift register. The scalar, or at least one element of the specified vector, requires a nonzero value for the object to generate a nonzero sequence.
Specify the index to select a Kasami sequence of interest from
the set of possible sequences. The default is
There are two classes of Kasami sequences: those obtained from a small set and those obtained from a large set. You choose a Kasami sequence from the small set by setting this property to a numeric, scalar, integer value in the range [0...2n/2–2]. You choose a sequence from the large set by setting this property to a numeric 12 integer vector [k m] for k in [–2,..., 2n–2], and m in [–1,..., 2n/2–2].
Sequence offset from initial time
Specify the offset of the Kasami sequence from its starting
point as a numeric, integer scalar value that can be positive or negative.
The default is
Enable variable-size outputs
Set this property to true to enable an additional input to the
step method. The default is false. When you set this property to true,
the enabled input specifies the output size of the Kasami sequence
used for the step. The input value must be less than or equal to the
value of the
When you set this property to false, the
Maximum output size
Specify the maximum output size of the Kasami sequence as a positive integer 2-element row vector. The second element of the vector must be 1. The default is [10 1].
This property applies when you set the
Number of output samples per frame
Specify the number of Kasami sequence samples that the step
method outputs as a numeric, positive, integer scalar value . The
default value is
When you set this property to a value of M,
Enable generator reset input
Set this property to
Data type of output
Specify the output data type as one of
|clone||Create Kasami sequence generator object with same property values|
|getNumInputs||Number of expected inputs to step method|
|getNumOutputs||Number of outputs from step method|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|reset||Reset states of Kasami sequence generator object|
|step||Generate a Kasami sequence|
Spread BPSK data with a Kasami sequence of length 255 by using the Kasami sequence System object.
Generate binary data and apply BPSK modulation.
data = randi([0 1],10,1); modData = pskmod(data,2);
Create a Kasami sequence object of length 255 using generator polynomial .
kasamiSequence = comm.KasamiSequence('Polynomial',[8 7 4 0], ... 'InitialConditions',[0 0 0 0 0 0 0 1],'SamplesPerFrame',255);
Generate the Kasami sequence and convert it to bipolar form.
kasSeq = kasamiSequence(); kasSeq = 2*kasSeq - 1;
Apply a gain of to ensure that the spreading operation does not increase the overall signal power.
kasSeq = kasSeq/sqrt(255);
Spread the BPSK data using the Kasami sequence.
spreadData = modData*kasSeq'; spreadData = spreadData(:);
Verify that the spread data sequence is 255 times longer than the input data sequence.
spreadingFactor = length(spreadData)/length(data)
spreadingFactor = 255
Verify that the spreading operation did not increase the signal power.
spreadSigPwr = sum(abs(spreadData).^2)/length(data)
spreadSigPwr = 1.0000
Change the generator polynomial of the Kasami sequence generator to after first releasing the object. Use the character representation of the polynomial.
release(kasamiSequence) kasamiSequence.Polynomial = 'x^8 + x^3 + 1';
Generate a new sequence and convert it to bipolar form.
kasSeq = kasamiSequence(); kasSeq = 2*kasSeq - 1;
This object implements the algorithm, inputs, and outputs described on the Kasami Sequence Generator block reference page. The object properties correspond to the block parameters, except:
The object does not have a property to select frame based outputs.
The object does not have a property that corresponds to the Sample time parameter.