Maximum Likelihood Detection in AWGN By Muhammad Imran Comsats Abbottabad, Pakistan
[email protected] LAB REPORT SOFTWARE: MATLAB Code: close all clear all clc N=100; %%%Number of Samples x=round(rand(1,N)); %Orirginal Signal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%Modulation for i=1:1:length(x) if (x(i)==0) y(i)=-1; else y(i)=1; end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$ %Received Signal=Modulated signal+Noise snr=5; %%%Signal-Noise Ratio power=1; %%Noise Power n=awgn(y,snr,power); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$ %Demodulation for i=1:1:length(n); if (n(i)<=0) z(i)=-1; else z(i)=1; end end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %BIT Error k=0; for i=1:1:length(z); if (z(i)~=y(i)) k=k+1; end end error_samples=k %Number of Error Signals %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Plotting figure (1) subplot(311) stem (y) title('Modulated Signal','FontSize',14) xlabel('------------n------->','FontSize',12); ylabel('Amplitude','FontSize',12); subplot(312) stem(n) title('Received Signal','FontSize',14); xlabel('------------n------->','FontSize',12); ylabel('Amplitude','FontSize',12); subplot(313) stem(z) title('Demodulated Signal','FontSize',14) xlabel('------------n------->','FontSize',12); ylabel('Amplitude','FontSize',12); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RESULTS: Modulated Signal Amplitude
1 0.5 0 -0.5 -1
0
10
20
30
40
50
60
70
80
90
100
60
70
80
90
100
60
70
80
90
100
------------n------->
Received Signal Amplitude
4 2 0 -2 -4
0
10
20
30
40
50
------------n------->
Demodulated Signal Amplitude
1 0.5 0 -0.5 -1
0
10
20
30
40
50
------------n------->
error_samples = 5
Conclusion:
In this lab, we have learnt how to modulate a signal, adding AWGN noise with power of “1” in it and then demodulating it. We found that at some SNR, we receive signal samples which are not same as modulated.