www.pudn.com > ldpc802.16.rar > qamdemod4soft.m, change:2005-11-16,size:860b


function [data_sym]=qamdemod4(data_in,sigma,type) 
 
map_table=[-0.7071 + 0.7071i  -0.7071 - 0.7071i  0.7071 + 0.7071i  0.7071 - 0.7071i]; 
%                          00                        01                       10                       11 
 
len=length(data_in); 
var=1*sigma; 
 
tmp=zeros(1,2*len); 
for i=1:len 
    r=data_in(i); 
     
    for j=1:4 
        d(j)=(real(r)-real(map_table(j))).^2+(imag(r)-imag(map_table(j))).^2; 
    end 
     
    D1_1=exp(-d(3)/var)+exp(-d(4)/var);D1_0=exp(-d(1)/var)+exp(-d(2)/var); 
    D2_1=exp(-d(2)/var)+exp(-d(4)/var);D2_0=exp(-d(1)/var)+exp(-d(3)/var); 
     
    switch type 
        case 'LR' 
            tmp(2*i-1)=D1_1/(D1_1+D1_0); 
            tmp(2*i)=D2_1/(D2_1+D2_0); 
        case 'LLR' 
            tmp(2*i-1)=log(D1_1/D1_0); 
            tmp(2*i)=log(D2_1/D2_0); 
    end 
end 
 
data_sym=tmp;