-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmod_qpsk.m
35 lines (29 loc) · 1010 Bytes
/
mod_qpsk.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function constelacionArray2 = mod_qpsk(bits)
%Variables to divide message into packet of 2 bits
tamanio=size(bits,2); %Total size of packet
div=1;
simbols=[]; %symbol matrix
while(div<tamanio)
%Message division into packets
m=bits(div:div+1);
div=div+2;
%Transform to symbols
s=bin2dec(num2str(m));
simbols=[simbols s];
end
for j=1:size(simbols,2)
if simbols(j)==0
constelacionArray2(j,1)=-1; %real value
constelacionArray2(j,2)=-1; %imaginary value
elseif simbols(j)==1
constelacionArray2(j,1)=-1; %real value
constelacionArray2(j,2)=1; %imaginary value
elseif simbols(j)==3
constelacionArray2(j,1)=1; %real value
constelacionArray2(j,2)=1; %imaginary value
else
constelacionArray2(j,1)=1; %real value
constelacionArray2(j,2)=-1;%imaginary value
end
end
end