Skip to main content

MatLab-wireless communication

The first step in any digital communications simulation is to create a source signal. Here, the source signal is a sequence of bits – or, in MATLAB terms, a vector of 0s and 1s.

You can use the randi function to create a column vector of randomly-generated 0s and 1s.

x = randi([0,1],numBits,1)


The first input sets the range of integers (0 and 1), the second input is the number of rows, and the third input is the number of columns.

The output x is a column vector containing numBits bits.
 
t1 
numBits = 20000
srcBits = randi([0,1],numBits,1)
 
 
16-QAM is a common single carrier modulation scheme. It maps 4 input bits to one of 16 complex numbers, called symbols. For each complex-valued symbol, the real and imaginary parts represent the in-phase and quadrature components, respectively, of a waveform.

The "16" in 16-QAM is the modulation order. It's useful to store the modulation order in a variable, so it can be used throughout your simulation.
t2
modOrder = 16
The qammod function creates a modulated QAM signal from an input sequence.

y = qammod(x,modOrder)


The modulated signal y is a sequence of QAM symbols — or, in MATLAB terms, a vector of complex numbers.

When the input sequence is made up of bits, set the property "InputType" to "bit".

y = qammod(x,modOrder,"InputType","bit")

t3
modOut = qammod(srcBits,modOrder,"InputType","bit")



Comments