-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsoft_demod.m
executable file
·33 lines (24 loc) · 1.02 KB
/
soft_demod.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
function y = soft_demod(symb, modOrd, gamma, noiseVariance)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Demodulates the stream of symbols accrording to the 16apsk mapping
% defined for a certain gamma value.
% Inputs :
% symb : The stream of 16 apsk modulated symbols
% gamma : The 16 apsk radii ratio
% Outputs :
% y : The stream of the 16APSK demapped bits
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Constellationa and bitMapping of the 16apsk
[constellation, bitMapping] = DVBS2Constellation(modOrd, gamma);
bitsPerSymbol = log2(modOrd);
N=length(symb);
bitextention=fliplr(de2bi(bitMapping));
llr=zeros(bitsPerSymbol,N);
for n=1:N
pyx=exp(-abs(symb(n)-constellation).^2./noiseVariance);
for ii=1:bitsPerSymbol
llr(ii,n)=log(sum(pyx'.*(1-bitextention(:,ii))))-log(sum(pyx'.*bitextention(:,ii)));
end
end
% The final 16apsk demmaped bit stream
y = reshape(llr, length(llr)*bitsPerSymbol, 1);