Thread Subject: Matlab code for BICM

Subject: Matlab code for BICM

From: birhane Alemayoh

Date: 6 Jan, 2010 13:00:08

Message: 1 of 3

Dear all
I am implementing a soft input soft output (SISO) MMSE detector and SISO decoder in an iterative fashion (turbo receiver). A de-interleaver and interleaver is used in between the detector and decoder. I am using a convolution encoder at the transmitter side. Therefore, my decoder is the Log MAP decoder.
 I have computed the extrinsic information of the output of the SISO MMSE detector and those will be delivered to the Log MAP decoder.
My question is, how do I calculate the gama parameter for the decoder having the a priori information from the detector.
I know that, in normal Log MAP decoder implemented with just BPSK, the main input to the decoder is the received signal. and the gama parameter (branch metric) may be calculated by computing the correlation of the received signal and all possible coded bits with in the corresponding time intervals.
please help me.
I am waiting your valuable response.

Subject: Matlab code for BICM

From: zand Andalibi

Date: 1 Apr, 2010 18:30:29

Message: 2 of 3

Hello,
I know how to calculate gama values, you should do this las follows, but I have a question for you, I did the same thing as you but my MMSE detector doesn't work, that is my code,

function [LLR1,LLR0]=SISO_MMSE_MIMO(H,y,Es,N0,Omega,List,La0,La1,nt,nr,m);
%Es: is the symbol energy of the constellation
%z=constellation points in bits format
%sz: constellation points in complex format
% m * n_t of a priori p(b=1) (La1) and p(b=0)(La0)
%Omega= constelatiopn set
% List : binary form of constellation list

for i=1: nt
    La1i(i,:)=La1((i-1)*m+1:i*m);
    La0i(i,:)=La0((i-1)*m+1:i*m);
    for k=1:2^m
        p(i,k)=prod(La1i(find(List(k,:)==1)))* prod(La0i(find(List(k,:)==0)));
    end
    mean(i)=sum( p(i,:)*Omega);
    sigma(i)= sum(p(i,:)* (abs(Omega).^2))- abs(mean(i))^2;
end
for i=1:nt
    Gamai=diag([sigma(1:i-1),Es, sigma(i+1:nt)]);
    ztilt(i)=Es.*(y-[mean(1:i-1), 0, mean(i+1:nt)]*H)* inv((H')* Gamai*H+N0.*eye(nr))*H(i,:)';
    mu(i)=(Es)* H(i,:) * inv((H')* Gamai*H+N0.*eye(nr))* H(i,:)';
    for k=1:2^m
        pztilti(i,k)=exp(-abs(ztilt(i)- mu(i)* Omega(k)).^2/(mu(i)*(1-mu(i))*Es))/(mu(i)*(1-mu(i))*Es*pi);
    end
end
LLR1=[];
LLR0=[];
for i=1:nt
    sk=[];
    sk0=[];
    for k=1:m
        sk=find(List(:,k)==1);
        sk0=find(List(:,k)==0);
        xi1(i,k)=pztilti(i,sk)*p(i,sk).';
        xi0(i,k)=pztilti(i,sk0)*p(i,sk0).';
        xi(i,k)=log(xi1(i,k)/xi0(i,k))-log(La1i(i,k)/La0i(i,k)) ;

    end
    LLR1=[LLR1 exp(xi(i,:))./(1+exp(xi(i,:)))];
    LLR0=[LLR0 1./(1+exp(xi(i,:)))];
end
I did it using Nicolas Gresset phd thesis. Can you help me?

and yours :

function [Lambda2_1,Lambda2_0,Ld_out_1,Ld_out_0,test]=siso_dec(lambda1_1,lambda1_0,G,k,tran,com_s,bra_o,flag);

% Copyright 2003 for academic use only
% SISO module for decoding of general convolutional codes
% tran, com_s, bra_o: description of trellis;

[n,Kk]=size(G);
K=Kk/k;
M=(K-1)*k;mx=2^M;

[n,l]=size(lambda1_1);
c=ones(1,l);
if flag==0;
   Ld_out=zeros(k,l);
end

%alpha_0(mx,:)=10^(-9);
alpha_0(mx,:)=0;
alpha_0(1,1)=1;
% Calculate alpha(:,1)
for s2=1:mx
   alpha(s2,1)=0;
   for p=1:2^k
      b=bra_o(com_s(s2,p)+(s2-1)*mx,:)';
      B=1;
      for i=1:length(b)
         if b(i)==1 B=B.*lambda1_1(i,1);
         else
            B=B.*lambda1_0(i,1);
         end;
      end;
      %if B==0 B=1e-40;end;
      %alpha(s2,1)=alpha(s2,1)+alpha_0(com_s(s2,p),1)*prod(0.5*(1+b.*tanh(0.5*lambda1(:,1))));
      alpha(s2,1)=alpha(s2,1)+alpha_0(com_s(s2,p),1)*B;
   end
end
%for i=1:mx if (alpha(i,1)< 1e-15) alpha(i,1)=1e-15;end;end;
c(1)=sum(alpha(:,1))^(-1);%if c(1)<1e-10 c(1)=1e-10;end;

%al1=alpha;
%al0=alpha_0;
alpha_T(:,1)=c(1)*alpha(:,1);
% Start forward recursion to calculate alpha(mx,2:l-1): Note the last index is (l-1)
for ik=2:l-1,
   for s2=1:mx,
      alpha_H(s2,ik)=0;
      for p=1:2^k,
         b=bra_o(com_s(s2,p)+(s2-1)*mx,:)';
         B=1;
         for i=1:length(b)
            if b(i)==1 B=B.*lambda1_1(i,ik);
            else
               B=B.*lambda1_0(i,ik);
   end;
           end;
         %if B==0 B=1e-40;end;
alpha_H(s2,ik)=alpha_H(s2,ik)+alpha_T(com_s(s2,p),ik-1)*B;
end
   end
   c(ik)=sum(alpha_H(:,ik))^(-1);if c(ik)<1e-10 c(ik)=1e-10;end;
   %if (c(ik)>1e+60) c(ik)=1e+60;end;
   alpha_T(:,ik)=c(ik)*alpha_H(:,ik);
end
%al=alpha_T;

%beta(mx,l)=10^(-9);
beta(mx,l)=0;
beta(1,l)=1;
%beta_T(mx,l)=10^(-9);
beta_T(mx,l)=0;
beta_T(1,l)=1;
% Calculate beta(:,l-1)
for s1=1:mx
beta(s1,l-1)=0;
   for p=1:2^k
      b=bra_o(s1+(tran(s1,p)-1)*mx,:)';
      B=1;
      for i=1:length(b)
         if b(i)==1 B=B.*lambda1_1(i,l);
         else
            B=B.*lambda1_0(i,l);
         end;
      end;
      %if B==0 B=1e-40;end;
      beta(s1,l-1)=beta(s1,l-1)+beta(tran(s1,p),l)*B;
   end
end
beta_T(:,l-1)=c(l-1)*beta(:,l-1);

% Start backward recursion to calculate beta(mx,1:l-2)
for ik=l-2:-1:1,
   for s1=1:mx,
      beta_H(s1,ik)=0;
      for p=1:2^k
         b=bra_o(s1+(tran(s1,p)-1)*mx,:)';
         B=1;
         for i=1:length(b)
          if b(i)==1 B=B.*lambda1_1(i,ik+1);
          else
            B=B.*lambda1_0(i,ik+1);
          end;
         end;
         %if B==0 B=1e-40;end;
      beta_H(s1,ik)=beta_H(s1,ik)+beta_T(tran(s1,p),ik+1)*B;
    end
end
beta_T(:,ik)=c(ik)*beta_H(:,ik);
end
%be=beta_T;

% Now we are ready to give the outputs

for ik=1:l, %actual index is 1:l
   top=zeros(n,1);bot=zeros(n,1);
   top_d=zeros(k,1);bot_d=zeros(k,1);
   for s1=1:mx, % scanning over all sigma_k states
      for edge=1:2^k, % scanning over all branches comming out from sigma_k state
         d=bin_stat(edge-1,k);
b=bra_o(s1+(tran(s1,edge)-1)*mx,:)';
         
        if (ik==1)
             for t=1:n
               pro_index=find([1:n]~=t);
               pro=1;
               for r=1:n-1
                  q=pro_index(r);
                  if b(q)==1
                     pro=pro.*lambda1_1(q,ik);
                  else
                     pro=pro.*lambda1_0(q,ik);
                  end;

               end
               if (b(t)==1)
       top(t)=top(t)+alpha_0(s1,ik)*beta_T(tran(s1,edge),ik)*pro;
          else
             bot(t)=bot(t)+alpha_0(s1,ik)*beta_T(tran(s1,edge),ik)*pro;
             end
          end
       else
            for t=1:n
               pro_index=find([1:n]~=t);
               pro=1;
               for r=1:n-1
                  q=pro_index(r);
                  if (b(q)==1)
                     pro=pro.*lambda1_1(q,ik);
                  else
                     pro=pro.*lambda1_0(q,ik);
                  end;
               end
               if (b(t)==1)
                  top(t)=top(t)+alpha_T(s1,ik-1)*beta_T(tran(s1,edge),ik)*pro;
               else
                  bot(t)=bot(t)+alpha_T(s1,ik-1)*beta_T(tran(s1,edge),ik)*pro;
             end
          end
end
         if flag==1
if (ik==1)
             for jj=1:k
                  if (d(jj)==1)
                     B=1;
                     for i=1:length(b)
    if b(i)==1 B=B.*lambda1_1(i,ik);
else
             B=B.*lambda1_0(i,ik);
          end;
       end;

                top_d(jj)=top_d(jj)+alpha_0(s1,ik)*beta_T(tran(s1,edge),ik)*B;
                  else
                     B=1;
                     for i=1:length(b)
    if b(i)==1 B=B.*lambda1_1(i,ik);
else
             B=B.*lambda1_0(i,ik);
          end;
       end;

bot_d(jj)=bot_d(jj)+alpha_0(s1,ik)*beta_T(tran(s1,edge),ik)*B;
end
          end
           else
    for jj=1:k
                  if (d(jj)==1)
                     B=1;
                     for i=1:length(b)
    if b(i)==1 B=B.*lambda1_1(i,ik);
else
             B=B.*lambda1_0(i,ik);
          end;
       end;

                top_d(jj)=top_d(jj)+alpha_T(s1,ik-1)*beta_T(tran(s1,edge),ik)*B;
                  else
                     B=1;
                     for i=1:length(b)
    if b(i)==1 B=B.*lambda1_1(i,ik);
else
             B=B.*lambda1_0(i,ik);
          end;
       end;

                bot_d(jj)=bot_d(jj)+alpha_T(s1,ik-1)*beta_T(tran(s1,edge),ik)*B;
             end
             end
            end
end
      end
   end
  % bot(find(bot==0))=10^(-10);top(find(top==0))=10^(-10);
  % bot_d(find(bot_d==0))=10^(-10);top_d(find(top_d==0))=10^(-10);
   bot(find(bot<10^(-10)))=10^(-10);top(find(top<10^(-10)))=10^(-10);
   bot_d(find(bot_d<10^(-10)))=10^(-10);top_d(find(top_d<10^(-10)))=10^(-10);
   lambda2_1(:,ik)=top;
   lambda2_0(:,ik)=bot;
   Ld_out_1(:,ik)=top_d;
   Ld_out_0(:,ik)=bot_d;
end
%Lambda2_1=lambda2_1+lambda1_1;
%Lambda2_0=lambda2_0+lambda1_0;
Lambda2_1=lambda2_1;
Lambda2_0=lambda2_0;
test=Ld_out_1+Ld_out_0;
%Lambda2=lambda2;


but I "birhane Alemayoh" <birhanea@gmail.com> wrote in message <hi21go$26a$1@fred.mathworks.com>...
> Dear all
> I am implementing a soft input soft output (SISO) MMSE detector and SISO decoder in an iterative fashion (turbo receiver). A de-interleaver and interleaver is used in between the detector and decoder. I am using a convolution encoder at the transmitter side. Therefore, my decoder is the Log MAP decoder.
> I have computed the extrinsic information of the output of the SISO MMSE detector and those will be delivered to the Log MAP decoder.
> My question is, how do I calculate the gama parameter for the decoder having the a priori information from the detector.
> I know that, in normal Log MAP decoder implemented with just BPSK, the main input to the decoder is the received signal. and the gama parameter (branch metric) may be calculated by computing the correlation of the received signal and all possible coded bits with in the corresponding time intervals.
> please help me.
> I am waiting your valuable response.

Subject: Matlab code for BICM

From: venkatesh

Date: 29 Apr, 2011 10:30:42

Message: 3 of 3

I am implementing BICMLM paper(2009 GLOBCOM). this paper also contains MMSE detection with iterative decoding using MAP decoder. I am unable to write the MAP decoder(for convolutional codes) for this type of system which has interleaver and MIMO system with 16-qam. can any one know how to write MAP or log-MAP decoder for MIMO system with interleaver ,higher order modulation

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com