Professional Documents
Culture Documents
Laboratory report
Lab 07
Simulation of a wireless link in Rayleigh channel in
MATLAB- SIMILINK
0
Þ Objective
• To study and understand Rayleigh channel.
Þ Procedures
o Execute commands/code.
2
Þ Simulation Results (Codes & Figures)
Part A- code:
Part A- Result:
Part B- Result:
4
Part C- code:
format long;
% Frame Length
bit_count = 10000;
%Range of SNR over which to simulate
SNR = 0: 1: 40;
% Start the main calculation loop
for aa = 1: 1: length(SNR)
% Initiate variables
T_Errors = 0;
T_bits = 0;
% Noise variance
N0 = 1/10^(SNR(aa)/10);
%---------------------------------------------------------------
% Equalization to remove fading effects. Ideal Equalization
% Considered
rx = rx./h;
end
% Calculate Bit Error Rate
BER(aa) = T_Errors / T_bits;
disp(sprintf('bit error probability = %f',BER(aa)));
end
%------------------------------------------------------------
% Finally plot the BER Vs. SNR(dB) Curve on logarithmic scale
5
% Calculate BER through Simulation
% Rayleigh Theoretical BER
SNRLin = 10.^(SNR/10);
theoryBer = 0.5.*(1-sqrt(SNRLin./(SNRLin+1)));
% Start Plotting
% Rayleigh Theoretical BER
figure(1);
semilogy(SNR,theoryBer,'-','LineWidth',2);
hold on;
% Simulated BER
figure(1);
semilogy(SNR,BER,'or','LineWidth',2);
hold on;
xlabel('SNR (dB)');
ylabel('BER');
title('SNR Vs BER plot for BPSK Modualtion in Rayleigh Channel');
% Theoretical BER
figure(1);
theoryBerAWGN = 0.5*erfc(sqrt(10.^(SNR/10)));
semilogy(SNR,theoryBerAWGN,'blad-','LineWidth',2);
legend('Rayleigh Theoretical','Rayleigh Simulated', 'AWGN Theoretical');
axis([0 40 10^-5 0.5]);
grid on;
Part B- Result:
6
bit error probability = 0.104900
7
bit error probability = 0.000222
8
Þ Observation/Findings
o I have found while applying the code in order to achieve the final required output,
that the in Rayleigh channel, SNR and BER have an inversely proportional
relationship. Meaning that the greater is the bit error ratio, the less is the signal
to noise ratio in dB.
Þ Discussion/Analysis
9
o Lastly, I applied a code that will compute the bit error rate for the BPSK
modulation. Also, this code will produce a figure that will discuss BER in the
y axis will SNR in dB in the x axis and show the plot for BPSK modulation
that occur in Rayleigh channel. It shows a comparison between the AWGN
channel and Rayleigh channel in those two parameters. We can analyze that
the AWGN theoretical line shows an incline line. This line describes that
whenever the bit error ratio decrease, the signal to noise ratio increase.
However, for the Rayleigh theoretical, the line shows the same relationship
but much sharper. Meaning that in Rayleigh theoretical when BER decrease,
the SNR will increase much faster and bigger than AWGN. Also, the
simulation of Rayleigh also is appropriate to the theory. Meaning there are no
major differences between the two, shown in figure 4. Furthermore, the result
explaining the bit error probability was displayed respectively to the code.
Þ Calculation
10
Þ Conclusion
o Overall, I accomplished the goals of this lab to study and understand the concept of
the Rayleigh channel and generate a figure of it in the MATLAB software
using two different ways; built-in function and histogram. Also, I was able to
learn about all different type of losses that can occur in a radio communication
system. But more importantly, during that I was able to come to the conclusion that
explained the relationship between the BEK and SNR in Rayleigh channel. I have
learned that this relationship is inversely proportional, meaning the more the BEK,
the smaller SNR. And lastly, I was able to reflect and analyze all of that using the
MATLAB simulation.
Þ References
o https://en.wikipedia.org/wiki/Rayleigh_distribution
11
Grading Rubric
12