bias=0;samp=1;
Lf1=4; Lb1=1; Lf2=4; Lb2=1;
M=2; P=2; 
method1='joint_sic';method2='joint_sicrev';

C1 = [1 -0.9;-0.4 1;1 0.9;0.4 1]; 
C2 = [-0.4 1;1 -0.9;0.4 1;1 0.9]; 

Lc=size(C1,1)/M;

for m=1:M,
  for p=1:P,
  c=C1((m-1)*Lc+1:m*Lc,p);
  C1((m-1)*Lc+1:m*Lc,p)=c/norm(c);
  c=C2((m-1)*Lc+1:m*Lc,p);
  C2((m-1)*Lc+1:m*Lc,p)=c/norm(c);  
end;
end;

for snr=1:20,

lambda=10^(-snr/10);

[F1, B1, delay1, Mse1] = dfe_tap_estmimo(C1, Lf1, Lb1, M, P, lambda*eye(P*Lf1), method1, bias, samp);
[F2, B2, delay2, Mse2] = dfe_tap_estmimo(C2, Lf2, Lb2, M, P, lambda*eye(P*Lf2), method2, bias, samp);
[Mse,Alpha]=bidfe_mse_mimo(C1,F1,B1,delay1,method1,C2,F2,B2,delay2,method2,lambda,M,P);

osnr1(:,snr)=-10*log10(Mse1);
osnr2(:,snr)=-10*log10(Mse2);
osnr(:,snr)=-10*log10(Mse');

end;

snr=1:20;
set(0,'DefaultAxesFontSize',18);
set(0,'DefaultTextFontSize',18);
set(0,'DefaultTextFontName','times');
set(0,'DefaultAxesFontName','times');

for m=1:M,
figure(m);
pl1=plot(snr,-osnr1(m,:),'r-*','LineWidth',2);
hold on;
pl2=plot(snr,-osnr2(m,:),'b-^','LineWidth',2);
pl3=plot(snr,-osnr(m,:),'k-o','LineWidth',2);
grid on;
legend([pl1,pl2,pl3],'Normal Mode DFE','Time-reversal mode DFE','LC-BiDFE');
xlabel('SNR  in  dB','FontSize',18);
ylabel('Output  SNR  in  dB','FontSize',18);
end;



