# How do i generate a mapping qpsk?

36 views (last 30 days)
Brendha Kobassigawa on 7 Sep 2022
Answered: Pulkit on 14 Sep 2022
cant found what function apply for [I,Q] = mappingqpsk
clear all, close cll, clc;
%-------------------------------------------------------------------------%
% Create bits to transmit %
%-------------------------------------------------------------------------%
%-------------------------------------------------------------------------%
% Map bits for transmition %
%-------------------------------------------------------------------------%
[I,Q] = mappingqpsk('bitstream');
figure(1)
subplot(2,1,1)
stem(I)
title('IQ')
legend('I')
subplot(2,1,2)
stem(Q,'r')
legend('Q')

Pulkit on 14 Sep 2022
According to my understanding you are trying to map input bitstreams to QPSK symbols, but you were unable to find function to do so in MATLAB.
The ‘QPSKModulatorfunction from the communication toolbox could be used to achieve this functionality. The following example code might help you.
%Creating Bitstream
bitstream=[0,1,1,1,1,1,0,1]'
bitstream = 8×1
0 1 1 1 1 1 0 1
%Create QPSK Modulator system object
hMod = comm.QPSKModulator('BitInput',true)
hMod =
comm.QPSKModulator with properties: PhaseOffset: 0.7854 BitInput: true SymbolMapping: 'Gray' OutputDataType: 'double'
%Modulating input bitstream
modOut = step(hMod, bitstream)
modOut =
-0.7071 + 0.7071i -0.7071 - 0.7071i -0.7071 - 0.7071i -0.7071 + 0.7071i
%Seperating real and Imag from Complex type
I=real(modOut)
I = 4×1
-0.7071 -0.7071 -0.7071 -0.7071
Q=imag(modOut)
Q = 4×1
0.7071 -0.7071 -0.7071 0.7071
or
Type the following command into the MATLAB command window to get more insight.
help comm.QPSKModulator