% This Matlab script compares the MSE performance, under the ideal feedback
% assumption, of a normal mode MMSE-DFE, an LC-BiDFE with MMSE DFE filter
% settings, an MMSE-BiDFE and the matched filter bound. A symmetric, 
% baud-spaced channel impulse response is assumed

C1=[0.3162 1 0.3162];

C=C1;
C=C/sqrt(C*C'); %'
Lf=4;
Lb=3;

MSE_conv=[];MSE_div=[];MSE_div_opt=[];

for snr=0:20,

lambda=10^(-snr/10);
[f_opt,b_opt,delay,mmse]=dfe_tap_estimator(C,Lf,Lb,lambda,1,0);
MSE_conv=[MSE_conv mmse];
[mmse,rho,alpha]=trdfe_mse(C,f_opt,b_opt,delay,f_opt,b_opt,delay,lambda);
MSE_div=[MSE_div mmse];
[f_opt,b_opt,delay,mmse]=trdfe_opt_taps(C,Lf,Lb,lambda);
MSE_div_opt=[MSE_div_opt mmse];

end;

snr=0:20;

set(0,'DefaultAxesFontSize',18);
set(0,'DefaultTextFontSize',18);
set(0,'DefaultTextFontName','times');
set(0,'DefaultAxesFontName','times');

figure;
pl1=plot(snr,10*log10(MSE_conv),'b-^','LineWidth',2);
hold on;
pl2=plot(snr,10*log10(MSE_div),'r-*','LineWidth',2);
pl3=plot(snr,10*log10(MSE_div_opt),'ko','LineWidth',2);
pl4=plot(snr,-snr,'m-.','LineWidth',2);
grid on;
legend([pl1,pl2,pl3,pl4],'Normal Mode DFE','LC-BiDFE : Suboptimal','LC-BiDFE : Optimal','Matched Filter Bound');
xlabel('SNR  in  dB','FontSize',18);
ylabel('MSE  in  dB','FontSize',18);








