Forums

Linar & DFE Equalizer

Started by hisylee May 22, 2008
Hi guys

Now I`m studying the Equalizer

I`m coding the linear and dfe EQ 

but there is no different

I don`t know what is wrong

can you correct this code or give me some idea

%%%%DFE(Training+Direct) vs. Linear%%%%
clear all;
N=1000;			        	% length of the information sequence
K=5;
actual_isi=[0.2, -0.15, 1.0, 0.21, 0.03];
sigma=0.01;
delta=0.08;    %0.08
delta2=0.00008;  %0.00008

Num_of_realizations=2000;
mse_av=zeros(1,N-2*K);
mse_avl=mse_av;
for j=1:Num_of_realizations,   		% Compute the average over a number of
realizations.
  % the information sequence
   p=0.5;
   info=binornd(1,p,1,1000);
   infol=info;
  % the channel output
  y=filter(actual_isi,1,info);
  for i=1:2:N, [noise(i) noise(i+1)]=gngauss(sigma);
  end;
  y=y+noise;
  yl=y;
  
  param = 0;
  c0(5) = param;                            %Precursor Filter Weight
Initialization
  c1(5) = param;
  c2(5) = param;
  c3(5) = param;
  c4(5) = param;
  
  d1(5) = param;                            %Postcursor Filter Weight
Initialization
  d2(5) = param;
  d3(5) = param;
%Linear Weight  
  cl0(5) = param;                            
  cl1(5) = param;
  cl2(5) = param;
  cl3(5) = param;
  cl4(5) = param;
end;  
  % Now the equalization part follows.
%DFE_Training
  for k=5:N-2*K,  %5:N-2*K
      e(k) = info(k) - [c4(k) c3(k) c2(k) c1(k) c0(k) -d1(k) -d2(k)
-d3(k)] * [y(k+4); y(k+3); y(k+2); y(k+1); y(k); info(k-1); info(k-2);
info(k-3)];
    
      xes(k) = [c4(k) c3(k) c2(k) c1(k) c0(k) -d1(k) -d2(k) -d3(k)] *
[y(k+4); y(k+3); y(k+2); y(k+1); y(k); info(k-1); info(k-2); info(k-3)];

      if xes(k) > 0.5
        xes2(k) = 1;
    elseif xes(k) < 0.5
        xes2(k) = 0;
    end
      
    c4(k+1) = c4(k) + delta * e(k) * y(k+4);
    c3(k+1) = c3(k) + delta * e(k) * y(k+3);
    c2(k+1) = c2(k) + delta * e(k) * y(k+2);
    c1(k+1) = c1(k) + delta * e(k) * y(k+1);
    c0(k+1) = c0(k) + delta * e(k) * y(k);
    d1(k+1) = d1(k) + delta2 * e(k) * info(k-1);
    d2(k+1) = d2(k) + delta2 * e(k) * info(k-2);
    d3(k+1) = d3(k) + delta2 * e(k) * info(k-3);
       
    %mse(k)=e(k)^2;
  
    if k>=500
    mu1 = 0.000001;     %0.000001
    mu2 = 0.00002;       %0.00002
    e(k) = xes2(k) - [c4(k) c3(k) c2(k) c1(k) c0(k) -d1(k) -d2(k) -d3(k)]
* [y(k+4); y(k+3); y(k+2); y(k+1); y(k); xes2(k-1); xes2(k-2); xes2(k-3)];
    
    xes(k+1) = [c4(k) c3(k) c2(k) c1(k) c0(k) -d1(k) -d2(k) -d3(k)] *
[y(k+4); y(k+3); y(k+2); y(k+1); y(k); xes2(k-1); xes2(k-2); xes2(k-3)];
          
    if xes(k+1) > 0.5
        xes2(k+1) = 1;
    elseif xes(k+1) < 0.5
        xes2(k+1) = 0;
    end;
    c4(k+1) = c4(k) + mu1 * e(k) * y(k+4);
    c3(k+1) = c3(k) + mu1 * e(k) * y(k+3);
    c2(k+1) = c2(k) + mu1 * e(k) * y(k+2);
    c1(k+1) = c1(k) + mu1 * e(k) * y(k+1);
    c0(k+1) = c0(k) + mu1 * e(k) * y(k);
    d1(k+1) = d1(k) + mu2 * e(k) * xes(k-1);
    d2(k+1) = d2(k) + mu2 * e(k) * xes(k-2);
    d3(k+1) = d3(k) + mu2 * e(k) * xes(k-3);
    
   %mse(k)=e(k)^2;  
    end;
     mse(k)=e(k)^2; 
end;
for i = 1:N-2*K
    error2(i) = (info(i) - xes(i))^2;
end;
%%%Direct

%%%Linear
for k=5:N-2*K
     el(k) = infol(k) - [cl4(k) cl3(k) cl2(k) cl1(k) cl0(k)] * [yl(k+4);
yl(k+3); yl(k+2); yl(k+1); yl(k);];
    
     xesl(k) = [cl4(k) cl3(k) cl2(k) cl1(k) cl0(k)] * [yl(k+4); yl(k+3);
yl(k+2); yl(k+1); yl(k);];
 
     if xesl(k) > 0.5
        xes2l(k) = 1;
    elseif xesl(k) < 0.5
        xes2l(k) = 0;
    end  
    
    cl4(k+1) = cl4(k) + delta * el(k) * yl(k+4);
    cl3(k+1) = cl3(k) + delta * el(k) * yl(k+3);
    cl2(k+1) = cl2(k) + delta * el(k) * yl(k+2);
    cl1(k+1) = cl1(k) + delta * el(k) * yl(k+1);
    cl0(k+1) = cl0(k) + delta * el(k) * yl(k);    
    msel(k)=el(k)^2;
 end;
 for i = 1:N-2*K
    errorl(i) = (infol(i) - xesl(i))^2;
end;
mse_av=mse_av+mse;
mse_avl=mse_avl+msel;
mse_av=mse_av/Num_of_realizations;
mse_avl=mse_avl/Num_of_realizations;% mean-squared error versus iterations

% Plotting commands follow.
figure
semilogy((abs(error2)),'b');title('DFE Error curve') ;
grid on; hold on;
figure
semilogy((abs(errorl)),'r');title('Linear Error curve') ;
grid on; hold on;
figure
semilogy((abs(mse_av)),'b');
grid on; hold on;
semilogy((abs(mse_avl)),'r') ;
title('Error curve') ;
xlabel('Samples')
ylabel('Error value')
legend('DFE','Linear');  %'error2','errorl2','DFE','Linear'
grid on; hold on;


Just looking at it quickly, your channel's frequency response is fairly
flat.  Try using a channel with a null at some frequency and see if the
results are still very similar.
>Just looking at it quickly, your channel's frequency response is fairly >flat. Try using a channel with a null at some frequency and see if the >results are still very similar. >
%%%%% HI... I have not looked at ur code as it will take time. If you are studying equaliser for first time, try to implement both LE and DFE for channel B of proakis i.e. channel=[0.407 0.815 0.407]; NOw try to implement two cases: 1. When u know channel at RX 2. When u dont knw First try to do for Uncoded case and get the results given in Proakis's book. And then apply coding. For DFE u should get some strange results (i.e. other than what u generally expect) Hope this helps. Feel free to ask any doubt regarding this topic anytime. Chintan