www.pudn.com > ldpc802.16.rar > qamdemod4soft_h.m, change:2005-10-18,size:817b


function [data_sym]=qamdemod4(data, channel, sigma) 
 
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); 
var=1*sigma; 
 
tmp=zeros(1,2*len); 
for i=1:len 
    r=data(i); 
    h=channel(i); 
%     r=r/h; 
%     var=2*sigma/abs(h).^2; 
     
    for j=1:4 
        d(j)=(real(r)-real(h*map_table(j))).^2+(imag(r)-imag(h*map_table(j))).^2; 
%         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); 
     
    tmp(2*i-1)=D1_1/(D1_1+D1_0); 
    tmp(2*i)=D2_1/(D2_1+D2_0); 
end 
 
data_sym=tmp;