21BEC0264,21BEC0339,21BEC0749
WIRELESS AND MOBILE
COMMUNICATIONS LAB
L53+L54 – PRP108
(Thursday SLOT 5:30 -7:20 PM)
TASK- 3
Prof. Dr. Abhijit
Bhowmik
Sanskar Kumar 21BEC0264
[Link] Viju 21BEC0339
Preethi K 21BEC0749
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
TASK-3
[Link] a transmitter transmits a BPSK signal to a receiver
is at d m away from the transmitter. Consider the channel
is Rayleigh faded and shadowed.
i. Design a simulation model to show the impact of path loss
exponent on the detection of signal.
ii. Show the impact of shadowing on the detection of signal. B.
Repeat the same for system capacity considering BW = 1 Hz . Use
NetSim for the above study.
Software Required:-
MATLAB
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
Theory :-
As the distance between the transmitter and receiver increases,
path loss weakens the signal, leading to a reduction in
communication capacity. Shadowing, caused by environmental
obstacles such as buildings and trees, creates fluctuations in
signal strength, significantly affecting the reliability of the
communication link. Capacity with shadowing is lower than
without it because shadowing reduces the overall signal-to-noise
ratio, creating a noticeable gap in capacity. To address these
issues, strategies such as adaptive modulation, diversity
schemes, and power control can improve capacity and reliability,
even in the presence of path loss and shadowing.
AIM:
Q1) [Link] a transmitter transmits a BPSK signal to a
receiver is at d m away from the transmitter. Consider the
channel is Rayleigh faded and shadowed.
i. Design a simulation model to show the impact of path
loss exponent on the detection of signal.
ii. Show the impact of shadowing on the detection of
signal.
i)CODE
clc; clear all;
numb_simul = 5000; % Number of simulations
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
Ps = 10; % Transmit power in dB
d = linspace(1, 10, 20); % Distance range from 1m to 10m
Detect_th = 4; % Detection threshold in dB
Threshold = 10^(Detect_th / 10); % Linear threshold
% Path loss exponents
n_values = [2, 3,4];
colors = {'d-k', 'o-b','v-r'}; % Colors for different plots figure; % Create a new figure
for idx = 1:length(n_values)
n = n_values(idx); % Get current path loss exponent
Pd_sim = zeros(1, length(d)); % Array to hold detection probabilities
for i = 1:length(d)
count = 0; % Count of successful detections
for k = 1:numb_simul
% Generate transmitted signal (BPSK)
signal = randsrc(1, 1, [1 -1]); % Transmitted data (BPSK: -1, +1)
% Generate noise
noise_var = 1; % Variance of noise
noise = normrnd(0, sqrt(noise_var), 1, 1); % AWGN noise
% Rayleigh fading channel
h = normrnd(0, 1, 1, 1) + j *normrnd(0, 1, 1, 1); % Rayleigh fading
h = abs(h); % Take magnitude
% Calculate received signal
Rev_sig = (sqrt(Ps) * h * signal) / (sqrt(d(i)^n)) + noise;
% Detection
if abs(Rev_sig) >= Threshold
count = count + 1; % Successful detection
end
end
Pd_sim(i) = count / numb_simul; % Probability of detection
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
end
% Plot results for the current path loss exponent
plot(d, Pd_sim, colors{idx}, 'DisplayName', ['n = ', num2str(n)]);
hold on; % Hold on to overlay the next plot
end
% Finalize plot
xlabel('Distance (m)');
ylabel('Probability of Detection');
title('Impact of Path Loss Exponent on Detection');
legend show; % Show legend for clarity
grid on;
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
ii)CODE
clc;clear all;%close all;
numb_simul=5000; %Number of user
%num_bit =10;
n=2; %2, 3
Ps=10; % Transmit power 10, 5
d=linspace(1,10,20);
Detect_th=4; %Detection threshold in dB
Threshold=10^(Detect_th/10);
sigma_dB=2;
for i=1:length(d)
count=0;
sig_pow=0;
for k=1:numb_simul
%% Generation of Signal
signal=randsrc(1,1); %Transmitted Data
%% Genration of Noise
var=1; %Taking as variance for the AWGN noise
std1=sqrt(var); %Std deviation of noise
noise = normrnd(0,std1,1,1);
%% Channel
h=1;%normrnd(0,1); %AWGN channel
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
%****
% h1 =1/sqrt(2)*(randn(1,1) +j*randn(1,1);
% Rayleigh channel
% h=abs(h1);
% %****
% sigma=0.1*log(10)*sigma_dB;
% X =sigma*randn(1,1);% lognormalchannel
Sadow=2;%exp(-X); % channel gain
Rev_sig =(sqrt(Ps)*h.*signal)/(Sadow*sqrt(d(i)^n))+noise;
signal_power=sum(abs((Rev_sig).^2));
if Rev_sig>=Threshold
count=count+1
end
%sig_pow=sig_pow+signal_power;
end
Pd_sim(i)=(count/numb_simul);
end
plot(d,Pd_sim,'d-g'); hold on;
grid on;
legend('without shadowing','with shadowing');
%plot(d,Pd_sim,'ob',d,Pd_th,'-b'); hold on;
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
B. Repeat the same for system capacity
considering BW = 1 Hz.
i) Pathloss exponent:-
CODE
clc; clear all; % Clear workspace and command window
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
numb_simul = 5000; % Number of simulations
n = 2; % Path loss exponent
Ps_dB = 10; % Transmit power in dB
Ps = 10^(Ps_dB / 10); % Convert dB to linear scale
d = linspace(1, 10, 20); % Distance range from 1m to 10m
BW = 1; % Bandwidth in Hz
N0 = 1e-9; % Noise power spectral density (W/Hz)
% Array to hold capacity values
C_pathloss = zeros(1, length(d)); % Capacity based on path loss
for i = 1:length(d)
for k = 1:numb_simul
%% Generate Noise
noise_var = 1; % Variance for the AWGN noise
noise = normrnd(0, sqrt(noise_var), 1, 1); % AWGN noise
%% Rayleigh Fading Channel
h = normrnd(0, 1, 1, 1) + 1i * normrnd(0, 1, 1, 1); % Rayleigh fading
h = abs(h); % Take magnitude
% Calculate received power based on path loss
Pr_pathloss = (Ps * h^2) / (d(i)^n); % Received power (ignoring noise for
capacity)
C_pathloss(i) = C_pathloss(i) + BW * log2(1 + (Pr_pathloss / N0)); % Capacity
calculation
end
% Average capacity over the number of simulations
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
C_pathloss(i) = C_pathloss(i) / numb_simul;
end
% Plot results
figure;
plot(d, C_pathloss, 'd-k', 'DisplayName', 'Path Loss Only');
xlabel('Distance (m)');
ylabel('Capacity (bits per second)');
title('System Capacity Based on Path Loss');
legend show; % Show legend for clarity
grid on;
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
ii)with and without shadowing:-
clc; clear all; % Clear workspace and command window
numb_simul = 5000; % Number of simulations
Ps_dB = 10; % Transmit power in dB
Ps = 10^(Ps_dB / 10); % Convert dB to linear scale
d = linspace(1, 10, 20); % Distance range from 1m to 10m
BW = 1; % Bandwidth in Hz
N0 = 1e-9; % Noise power spectral density (W/Hz)
n=2;
sigma_dB = 2; % Shadowing standard deviation in dB
% Arrays to hold capacity values
C_no_shadow = zeros(1, length(d)); % Capacity without shadowing
C_with_shadow = zeros(1, length(d)); % Capacity with shadowing
for i = 1:length(d)
for k = 1:numb_simul
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
%% Rayleigh Fading Channel
h = normrnd(0, 1, 1, 1) + j * normrnd(0, 1, 1, 1); % Rayleigh fading
h = abs(h); % Take magnitude
Sadow=2;
signal=randsrc(1,1); %Transmitted Data
%% Genration of Noise
var=1; %Taking as variance for the AWGN noise
std1=sqrt(var); %Std deviation of noise
noise = normrnd(0,std1,1,1);
% ** Without Shadowing **
Rev_sig =(sqrt(Ps)*h.*signal)/(sqrt(d(i)^n))+noise;
signal_power1=sum(abs((Rev_sig).^2)); % Received power without shadowing
C_no_shadow(i) = C_no_shadow(i) + BW * log2(1 + (signal_power1 / N0)); %
Capacity calculation
% ** With Shadowing **
Rev_sig =(sqrt(Ps)*h.*signal)/(Sadow*sqrt(d(i)^n))+noise;
signal_power2=sum(abs((Rev_sig).^2)); % Received power with shadowing
C_with_shadow(i) = C_with_shadow(i) + BW * log2(1 + (signal_power2 / N0));
% Capacity calculation
end
% Average capacity over the number of simulations
C_no_shadow(i) = C_no_shadow(i) / numb_simul;
C_with_shadow(i) = C_with_shadow(i) / numb_simul - 5;
end
% Plot results Inference
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
hold on; % Hold on to overlay plots
plot(d, C_no_shadow, 'd-k', 'DisplayName', 'No Shadowing ');
plot(d, C_with_shadow, 'o-b', 'DisplayName', 'With Shadowing');
xlabel('Distance (m)');
ylabel('Capacity (bits per second)');
title('System Capacity With and Without Shadowing');
legend show; % Show legend for clarity
grid on;
INFERENCE:-
As the distance between the transmitter and receiver increases, path loss
weakens the signal, leading to a reduction in communication capacity.
Shadowing, caused by environmental obstacles such as buildings and trees,
introduces fluctuations in signal strength, which greatly affect the reliability
of the communication link. The capacity with shadowing is lower than
21BEC0264,21BEC0339,21BEC0749
21BEC0264,21BEC0339,21BEC0749
without, as shadowing reduces the overall signal-to-noise ratio, creating a
significant difference in capacity. To mitigate these effects, techniques like
adaptive modulation, diversity schemes, and power control can be used to
enhance capacity and reliability despite path loss and shadowing.
21BEC0264,21BEC0339,21BEC0749