-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmodulation.m
executable file
·35 lines (24 loc) · 1.02 KB
/
modulation.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 y = modulation(bits, modOrd, gamma)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mdulates the stream of input bits according to the 16apsk mapping
% defined for a certain gamma value.
% Inputs :
% symb : The stream of input bits
% gamma : The 16 apsk radii ratio
% Outputs :
% y : The stream of 16apsk modulated symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bitsPerSymbol = log2(modOrd);
% Constellation and 16APSK bitMapping
[constellation, bitMapping] = DVBS2Constellation(modOrd,gamma);
% Converting bits into decimal values for mapping
matx = reshape(bits, bitsPerSymbol,length(bits)/bitsPerSymbol)';
mapp = bi2de(fliplr(matx),2)';
symb= zeros(1,length(mapp));
% Mappinf the values onto the correspondant constellation points
for i=1:length(mapp)
[idx2,idx]= find(bitMapping == mapp(i));
symb(i)= constellation(idx);
end
% The stream of 16apsk constellation symbols
y = symb.';