Académique Documents
Professionnel Documents
Culture Documents
clear all
clc;
H=hadamard(16);
S=H(:,1:10); % S is the channel of length 16*10
s=(1/sqrt(16))*S;
k=10; % k is the number of iterations over which the avverage is taken.
%% Calculations for dc
R_dc=s'*s; % R_dc is the de correlator
est_dc=(R_dc^-1)*est_mf; % The only way that dc is differ
from mf is: The estimated transmitted bits est_dc are obtained
differently
% Remaining procedure below is
same
% as that of mf.
for k=1:10
if est_dc(k,1)>=0
hat_dc(k,1)=1;
else
hat_dc(k,1)=-1;
end
end
e_dc=0;
for k=1:10
if hat_dc(k,1)~=b(k,1)
e_dc=e_dc+1;
else
end
end
pe_dc(i)=e_dc/k;
%% for mms
R_mms=s'*s+(sigma_n^2)*eye(10); % R_mms is the mms correlator
est_mms=(R_mms^-1)*est_mf;
hat_mms=zeros(10,1);
for j=1:10
if est_mms(j,1)>=0
hat_mms(j,1)=1;
else
hat_mms(j,1)=-1;
end
end
e_mms=0;
for k=1:10
if hat_mms(k,1)~=b(k,1)
e_mms=e_mms+1;
end
end
pe_mms(i)=e_mms/k;
%%
end % end for (for i=500)
pe_snr_dc(snr)=mean(pe_dc); % mean value of erro for 500 bits
(and not of the 10 copies(iterations) of the bits)
pe_snr_mf(snr)=mean(pe_mf);
pe_snr_mms(snr)=mean(pe_mms);
semilogy([1:30],[pe_snr_mf],'r')
title('error probability curve for mf')
figure
semilogy([1:30],[pe_snr_mms],'k')
title('error probability curve for mms')
figure
semilogy([1:30],[pe_snr_dc],'b')
title('error probability curve for dc')