Hi, i would like to study the performance of ZF and MMSE equalizers over SISO Rayleigh fading channel my code does not work correctly can someone help me please

15 views (last 30 days)
clc clear all
nCP = 8;%round(Tcp/Ts); nFFT = 16; NT = nFFT + nCP;
F = dftmtx(nFFT)/sqrt(nFFT); MC = 1500;
EsNodB = 0:15; snr = 10.^(EsNodB/10); beta = 17/9;
L = 5; ChEstLS = zeros(1,length(EsNodB));
for ii = 1:length(EsNodB) disp('EsN0dB is :'); disp(EsNodB(ii));tic; ChMSE_LS = 0;
for mc = 1:MC
% Random channel taps
g = 1/sqrt(0.5)*(randn(L,1)+1i*randn(L,1));
g = g/norm(g);
H = fft(g,nFFT);
% generation of symbol
X=rand(nFFT,1)>0.5;
XD=2*X-1;
x = F'*XD;
xout = [x(nFFT-nCP+1:nFFT);x];
% channel convolution and AWGN
y = conv(xout,g);
nt =randn(nFFT+nCP+L-1,1) + 1i*randn(nFFT+nCP+L-1,1);
No = 10^(-EsNodB(ii)/10);
y = y + sqrt(No/2)*nt;
% Receiver processing
y = y(nCP+1:NT);
Y = F*y;
% frequency doimain LS channel estimation
HhatLS = Y./XD;
ChMSE_LS = ChMSE_LS + ((H -HhatLS)'*(H-HhatLS))/nFFT;
% Time domain LMMSE estimation ghatLS = ifft(HhatLS,nFFT);
end
ChEstLS(ii) = ChMSE_LS/MC;
toc;
%%%%%%%%%%%%%EQUALIZATION
for runs=1:5000
Hest=toeplitz(HhatLS); %Hest=diag(HhatLS); wzf=inv(Hest'*Hest)*Hest'; xest=wzf*Y;
xe=inv(F')*xest;
% %BPSK demodulation
% % +ve value --> 1, -ve value --> -1
ipModHat = 2*floor(real(xe/2)) + 1;
ipModHat(find(ipModHat>1)) = +1;
ipModHat(find(ipModHat<-1)) = -1;
% converting modulated values into bits
ipBitHat = (ipModHat+1)/2;
% ipBitHat=xest>0;
% ipBitHat = reshape(ipBitHat.',nFFT,1).';
% counting the errors
% nErr(ii) = size(find(ipBitHat - X),2);
err=find(ipBitHat~=X);
Err_Ratio(runs)=length(err)./length(X);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
W=(Hest'*Hest)+((1/snr(ii))*eye(nFFT));
W_mmse=Hest'*inv(W);
xest2=W_mmse*Y;
xes=inv(F')*xest2;
%BPSK demodulation
% % +ve value --> 1, -ve value --> -1
ipModHat1 = 2*floor(real(xes/2)) + 1;
ipModHat1(find(ipModHat>1)) = +1;
ipModHat1(find(ipModHat<-1)) = -1;
% converting modulated values into bits
ipBitHat1 = (ipModHat+1)/2;
err1=find(ipBitHat1~=X);
Err_Ratio1(runs)=length(err1)./length(X);
end
BER(ii)=mean(Err_Ratio);
BER1(ii)=mean(Err_Ratio1);
end
% Channel estimation semilogy(EsNodB,ChEstLS,'-.r*','LineWidth',2); hold on;grid on;xlabel('EsNodB'); ylabel('Channel MSE');
% Theoratical bound calculation %semilogy(EsNodB,beta./snr,'-.r*','LineWidth',2);
legend('LS');
% plot
figure (2) semilogy(EsNodB,BER,'bs-','Linewidth',2); hold on semilogy(EsNodB,BER1,'gd-','Linewidth',2); %axis([0 20 10^-5 0.5]) grid on h=legend('sim-zf','sim-mmse'); set(h,'visible','on'); xlabel('Eb/No, dB'); ylabel('Bit Error Rate'); title('Bit error probability curve for ZF and MMSE equalizers');
%

Answers (0)

Categories

Find more on Detection, Range and Doppler Estimation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!