0% found this document useful (0 votes)
28 views34 pages

Report04

This document contains code and results from experiments on wireless channel models performed by a student. [Experiment 3 examines channel models for wireless communication systems, modeling free space path loss, log distance path loss, and log normal shadowing path loss. Experiments 2 and 4 analyze the Rayleigh and Rician fading distributions and apply them to model received signals. Experiment 5 simulates large-scale and small-scale fading versus distance.]

Uploaded by

anjan joy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views34 pages

Report04

This document contains code and results from experiments on wireless channel models performed by a student. [Experiment 3 examines channel models for wireless communication systems, modeling free space path loss, log distance path loss, and log normal shadowing path loss. Experiments 2 and 4 analyze the Rayleigh and Rician fading distributions and apply them to model received signals. Experiment 5 simulates large-scale and small-scale fading versus distance.]

Uploaded by

anjan joy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

BANGLADESH UNIVERSITY OF ENGINEERING AND TECHNOLOGY

Department of Electrical and Electronic Engineering

Course Number: EEE 438


Course Name: Wireless Communication Laboratory

Experiment No: 3
Experiment Name: Channel Models for Wireless Communication
Systems

Name: Indrojit Sarkar


Student ID: 1806090
Group: G1 (lab group – 02 (86,90))
Task 1:
Related Code:

clc;

clear all;

close all;

%%%%%%%%%%Lab Task 1 %%%%%%%%%%%

%% Free Space Path Loss

f = 1.5e9;

Gt = 1;

Gr = 1;

d0 = 100;

c = 3e8;

lamda = c/f;

d = 1: 2000;

PL_free = -10*log10(Gt*Gr*(lamda^2)./(16*pi*pi*d.*d));

% Plotting Free Space Path Loss

figure(1)

subplot(211)

plot(d,PL_free)

title('Distance vs Path Loss')

xlabel('Distance in Natural Units')

ylabel('Path Loss')

subplot(212)

d_dB = 10*log10(d);

plot(d_dB,PL_free)

title('Distance vs Path Loss')

xlabel('Distance in dB')

ylabel('Path Loss')
P_transmitted = 10*log10(4000);

P_received = P_transmitted - PL_free;

% Plotting Received Power

figure(2)

subplot(211)

plot(d,P_received)

title('Distance vs Received Power')

xlabel('Distance in Natural Units')

ylabel('Received Power')

subplot(212)

d_dB = 10*log10(d);

plot(d_dB,P_received)

title('Distance vs Received Power')

xlabel('Distance in dB')

ylabel('Received Power')

%% Log Distance Path Loss Model:

n_values = [2 3 6];

for i = 1: length(n_values)

n = n_values(i);

PL_log_distance = PL_free(d0) + 10*n*log(d./d0);

% Plotting Log Distance Path Loss

figure(3)

subplot(211)

plot(d,PL_log_distance)

hold on
title('Distance vs Log Distance Path Loss')

xlabel('Distance in Natural Units')

ylabel('Log Distance Path Loss')

legend('n=2','n=3','n=6')

subplot(212)

plot(d_dB,PL_log_distance)

hold on

title('Distance vs Log Distance Path Loss')

xlabel('Distance in dB')

ylabel('Log Distance Path Loss')

legend('n=2','n=3','n=6')

P_received = P_transmitted - PL_log_distance;

% Plotting Received Power

figure(4)

subplot(211)

plot(d,P_received)

hold on

title('Distance vs Received Power')

xlabel('Distance in Natural Units')

ylabel('Received Power')

legend('n=2','n=3','n=6')

subplot(212)

d_dB = 10*log10(d);

plot(d_dB,P_received)

hold on

title('Distance vs Received Power')

xlabel('Distance in dB')
ylabel('Received Power')

legend('n=2','n=3','n=6')

end

%% Log Normal Shadowing Path Loss Model:

n = 2;

sigma = 3;

X_sigma = sigma.*randn(1, length(d));

X_sigma_dB = 10*log10(X_sigma);

PL_Log_normal = PL_log_distance + X_sigma_dB;

% Plotting Log Normal Shadowing Path Loss

figure(5)

subplot(211)

plot(d,PL_Log_normal)

title('Distance vs Log Normal Shadowing Path Loss')

xlabel('Distance in Natural Units')

ylabel('Log Normal Shadowing Path Loss')

subplot(212)

plot(d_dB,PL_Log_normal)

title('Distance vs Log Normal Shadowing Path Loss')

xlabel('Distance in dB')

ylabel('Log Normal Shadowing Path Loss')

P_received = P_transmitted - PL_Log_normal;

% Plotting Received Power

figure(6)
subplot(211)

plot(d,P_received)

title('Distance vs Received Power')

xlabel('Distance in Natural Units')

ylabel('Received Power')

subplot(212)

d_dB = 10*log10(d);

plot(d_dB,P_received)

title('Distance vs Received Power')

xlabel('Distance in dB')

ylabel('Received Power')
Task 2:
Code:

clc;

clear all;

close all;

%% PDF and CDF of Rayleigh Distribution

N = 1e5;

level = 30;

sigma_values = [1/sqrt(2), 1];

figure(1)

for idx = 1:length(sigma_values)

H = sigma_values(idx) * (randn(1, N) + 1i*randn(1, N));


[PDF, x] = hist(abs(H(1, :)), level);

% Plotting PDF

subplot(211)

plot(x, PDF)

title('Rayleigh Distribution');

xlabel('Value')

ylabel('PDF');

legend('1/sqrt(2)', '1');

hold on;

% Plotting CDF

subplot(212)

plot(x, cumsum(PDF))

xlabel('Value')

ylabel('CDF');

legend('1/sqrt(2)', '1');

hold on;

end

%% PDF and CDF of Rician Distribution

N = 1e5;

level = 30;

K_dB_values = [-40, 15];

figure(2);

for i = 1:length(K_dB_values)

K = 10^(K_dB_values(i)/10);
sigma = 1/sqrt(2);

s = sqrt(K*2*sigma^2);

X = s + sigma*randn(1, N);

Y = 0 + sigma*randn(1, N);

H = X + 1i*Y;

[PDF, x] = hist(abs(H(1, :)), level);

% Plotting PDF

subplot(211)

plot(x, PDF);

xlabel('Value')

ylabel('PDF');

legend('k = -40 dB', 'k = 15 dB');

hold on;

title('Rician Distribution');

% Plotting CDF

subplot(212)

plot(x, cumsum(PDF))

xlabel('Value');

ylabel('CDF');

legend('k = -40 dB', 'k = 15 dB');

hold on;

end

%% Square Pulse: Rayleigh and Rician

N = 300;

sigma_rayleigh = 1;
sigma_rician_dB = 15;

% Rayleigh

H_rayleigh = sigma_rayleigh * (randn(1, N) + 1i*randn(1, N));

signal_rayleigh = [ones(1, 100), -1*ones(1, 100), ones(1, 100)];

rcv_signal_rayleigh = abs(H_rayleigh).*signal_rayleigh;

% Rician

K_rician = 10^(sigma_rician_dB/10);

sigma_rician = 1/sqrt(2);

s_rician = sqrt(K_rician*2*sigma_rician^2);

X_rician = s_rician + sigma_rician*randn(1, N);

Y_rician = 0 + sigma_rician*randn(1, N);

H_rician = X_rician + 1i*Y_rician;

signal_rician = [ones(1, 100), -1*ones(1, 100), ones(1, 100)];

rcv_signal_rician = abs(H_rician).*signal_rician;

% Plotting Received signals

figure(3)

subplot(211)

plot(signal_rayleigh);

hold on;

plot(rcv_signal_rayleigh);

title('Received signal (Rayleigh)');

legend('Tx signal', 'Rx signal');

subplot(212)

plot(signal_rician);

hold on;
plot(rcv_signal_rician);

title('Received signal (Rician)');

legend('Transmitted Signal', 'Received Signal');


Task 3:

Code:

clc;

clear all;

close all;

%% Indoor Model

num_channels = 10000;

Ts = 50e-9;

sigma_tau = 25e-9;
N = 256;

p_max = ceil(10 * sigma_tau / Ts);

x = 1:0.01:1000;

sigma_not = (1 - exp(-Ts / sigma_tau)) / (1 - exp(-(p_max + 1) * Ts / sigma_tau));

rayleigh_model = @(L) (randn(1, L) + 1i * randn(1, L)) / sqrt(2);

for i = 0:p_max

PDP(i + 1) = sigma_not * exp(-i * Ts / sigma_tau);

end

for k = 1:length(PDP)

h(:, k) = rayleigh_model(num_channels) .* sqrt(PDP(k));

avg_pow_h(k) = mean(h(:, k) .* conj(h(:, k)));

end

H = fft(h(1, :), N);

channel_tap_index = 0:length(PDP) - 1;

figure(1)

subplot(211)

stem(channel_tap_index, PDP, 'ko')

hold on,

stem(channel_tap_index, avg_pow_h, 'r.');

xlabel('Channel Tap Index, p')

ylabel('Average Channel Power');

title('IEEE Model: Channel Tap Index (p) vs Average Channel Power ');

legend('Ideal Case', 'Simulated Case')

axis([-1 7 0 1]);

subplot(212)
plot([-N/2 + 1:N/2] / N / Ts / 1e6, 10 * log10(H .* conj(H)));

xlabel('Frequency [MHz]')

ylabel('Channel Power [dB]')

title('Frequency Response: Frequency [MHz] vs Channel Power [dB]')

Task 4:
Code:

clc;

clear all;

close all;

% Parameters

fc = 0;

fm = 100;

Nos = 1;

Nfft = 2^10;

Nifft = Nfft * Nos;

delf = 2 * fm / Nfft;

Tfading = 1 / (Nos * delf);


Ts = 1 / (2 * fm * Nos);

%% Doppler spectrum generation

f = zeros(1, Nfft);

Sd = zeros(1, Nfft);

for n = 1:Nfft/2

f(n) = n * delf;

Sd(n) = 1.5 / (pi * fm * sqrt(1 - ((f(n)) / fm).^2));

end

Sd(Nfft/2) = Sd(Nfft/2 - 1) + 0.1;

for n = Nfft/2 + 1:Nfft

f(n) = n * delf;

Sd(n) = Sd(Nfft - n + 1);

end

Sd(Nfft/2 + 1) = Sd(Nfft/2) + 0.1;

% Folding removal

g = -Nfft/2 + 1:1:Nfft;

Sd_z = ones(1, length(Sd));

Sd_z(1:Nfft/2) = Sd(Nfft/2 + 1:Nfft);

Sd_z(Nfft/2 + 1:Nfft) = Sd(1:Nfft/2);

% Plot Doppler spectrum

figure;
subplot(211);

plot(g(1:1024), Sd_z);

axis([-101 101 0 0.08]);

title('Doppler Spectrum');

xlabel('Frequency (Hz)');

ylabel('Power Spectral Density');

subplot(212);

plot(f, Sd);

title('Doppler Spectrum');

xlabel('Frequency (Hz)');

ylabel('Power Spectral Density');

%% Complex Noise Generation

NI(1:Nfft/2) = randn(1, Nfft/2) + 1i * randn(1, Nfft/2);

NQ(1:Nfft/2) = randn(1, Nfft/2) + 1i * randn(1, Nfft/2);

for n = Nfft/2 + 1:Nfft

NI(n) = conj(NI(Nfft - n + 1));

NQ(n) = conj(NQ(Nfft - n + 1));

end

%% Filtering by the Doppler Filter

FNI = NI .* sqrt(Sd);

FNQ = NQ .* sqrt(Sd);

% Over sampling

FNI_Nos = [FNI(1:Nfft/2) zeros(1, Nifft - Nfft) FNI(Nfft/2 + 1:Nfft)];

FNQ_Nos = [FNQ(1:Nfft/2) zeros(1, Nifft - Nfft) FNQ(Nfft/2 + 1:Nfft)];


% IFFT calculation

FNIt = ifft(FNI_Nos, Nifft);

FNQt = ifft(FNQ_Nos, Nifft);

% Normalization

FNI_env = abs(FNIt);

FNQ_env = abs(FNQt);

FNI_norm = sqrt(mean(FNI_env .* FNI_env));

FNQ_norm = sqrt(mean(FNQ_env .* FNQ_env));

FNIt = FNIt / FNI_norm;

FNQt = FNQt / FNQ_norm;

% Performing square of absolute value

FNIt_sq = (abs(FNIt)).^2;

FNQt_sq = (abs(FNQt)).^2;

% Sum and square-root

h = sqrt(FNIt_sq + FNQt_sq);

phase = angle(FNIt + 1j * FNQt);

% Plot of channel h

figure;

subplot(211);

plot((1:length(h)) .* Ts, 10 * log10(h));

title('Time vs Magnitude (dB)');

xlabel('Time');
ylabel('Magnitude (dB)');

axis([0 0.5 -30 10]);

subplot(212);

hist(h, 50);

title('Histogram of Magnitude');

xlabel('Magnitude');

ylabel('Count');

Task 5:
Code:

clear all;

close all;

% Parameters

transmit_power = 5;

frequency = 2e9;

channel_bandwidth = 180e3;

area_length = 4e3;
area_width = 6e3;

psd_awgn = -174;

wavelength = 3e8 / frequency;

% Large-Scale Fading vs. Distance

distance_range = 200:200:5000;

received_power_large_scale = zeros(size(distance_range));

received_power_small_scale = zeros(size(distance_range));

for i = 1:length(distance_range)

distance = distance_range(i);

path_loss_large_scale = 20 * log10((4 * pi * distance) / wavelength);

small_scale_fading = (randn + 1i * randn) / sqrt(2);

path_loss_small_scale = 10 * log10(abs(small_scale_fading)^2);

received_power_total = transmit_power - path_loss_large_scale - path_loss_small_scale;

received_power_large_scale(i) = transmit_power - path_loss_large_scale;

received_power_small_scale(i) = received_power_total;

end

figure;

plot(distance_range, received_power_large_scale, 'o-', 'DisplayName', 'Large-Scale Fading');

hold on;

plot(distance_range, received_power_small_scale, 'o-', 'DisplayName', 'Large-Scale + Small-Scale


Fading');
xlabel('Distance (m)');

ylabel('Received Power (dBm)');

title('Distance vs. Received Power');

legend('Location', 'Best');

grid on;

% BER vs. Transmit Signal Power

frequency = 2e9;

channel_bandwidth = 180e3;

distance = 500;

noise_bandwidth = 180e3;

transmit_power_range = 5:5:40;

ber_large_scale = zeros(size(transmit_power_range));

ber_small_scale = zeros(size(transmit_power_range));

for i = 1:length(transmit_power_range)

transmit_power = transmit_power_range(i);

path_loss_large_scale = 20 * log10((4 * pi * distance) / (3e8 / frequency));

snr_large_scale = transmit_power - path_loss_large_scale - psd_awgn + 10 * log10(noise_bandwidth);

ber_large_scale(i) = 0.1 * exp(-snr_large_scale / 10);

small_scale_fading = (randn + 1i * randn) / sqrt(2);

snr_small_scale = transmit_power - path_loss_large_scale - 10 * log10(abs(small_scale_fading)^2) -


psd_awgn + 10 * log10(noise_bandwidth);

ber_small_scale(i) = 0.05 * exp(-snr_small_scale / 15);

end
figure;

semilogy(transmit_power_range, ber_large_scale, 'o-', 'DisplayName', 'Large-Scale Fading');

hold on;

semilogy(transmit_power_range, ber_small_scale, 'o-', 'DisplayName', 'Small-Scale Fading');

xlabel('Transmit Signal Power (W)');

ylabel('Bit Error Rate (BER)');

title('BER vs. Transmit Signal Power at 0.5 km Distance');

legend('Location', 'Best');

grid on;

% BER vs. Transmit Signal Power with Different Fading Channels

ber_large_scale_indoor = zeros(size(transmit_power_range));

ber_large_scale_outdoor = zeros(size(transmit_power_range));

ber_small_scale = zeros(size(transmit_power_range));

for i = 1:length(transmit_power_range)

transmit_power = transmit_power_range(i);

path_loss_large_scale_indoor = 20 * log10((4 * pi * distance) / (3e8 / frequency));

path_loss_large_scale_outdoor = 20 * log10((4 * pi * distance) / (3e8 / frequency));

large_scale_fading_indoor = path_loss_large_scale_indoor + normrnd(0, 4);

large_scale_fading_outdoor = path_loss_large_scale_outdoor + normrnd(0, 8);

snr_large_scale_indoor = transmit_power - large_scale_fading_indoor - psd_awgn + 10 *


log10(noise_bandwidth);

snr_large_scale_outdoor = transmit_power - large_scale_fading_outdoor - psd_awgn + 10 *


log10(noise_bandwidth);
ber_large_scale_indoor(i) = 0.1 * exp(-snr_large_scale_indoor / 10);

ber_large_scale_outdoor(i) = 0.1 * exp(-snr_large_scale_outdoor / 10);

small_scale_fading = (randn + 1i * randn) / sqrt(2);

snr_small_scale = transmit_power - 10 * log10(abs(small_scale_fading)^2) - psd_awgn + 10 *


log10(noise_bandwidth);

ber_small_scale(i) = 0.05 * exp(-snr_small_scale / 15);

end

figure;

semilogy(transmit_power_range, ber_large_scale_indoor, 'o-', 'DisplayName', 'Large-Scale Fading


(Indoor)');

hold on;

semilogy(transmit_power_range, ber_large_scale_outdoor, 'o-', 'DisplayName', 'Large-Scale Fading


(Outdoor)');

semilogy(transmit_power_range, ber_small_scale, 'o-', 'DisplayName', 'Small-Scale Fading');

xlabel('Transmit Signal Power (W)');

ylabel('Bit Error Rate (BER)');

title('BER vs. Transmit Signal Power with Different Fading Channels');

legend('Location', 'Best');

grid on;
Ques no 1:

The path loss exponent n in a wireless communication system is a parameter that characterizes the rate
at which the signal strength decreases with distance. The path loss model is often represented as:

{Path Loss (dB)} = {Reference Path Loss} + 10nlog_{10}[ {d}/{d_0}] + X ]

where:

- n is the path loss exponent,

- d is the distance from the transmitter,

- d_0 is the reference distance,

- X represents additional factors (shadowing, fading, etc.).

The effect of the path loss exponent n before and after the reference distance (\(d_0\)) is as follows:

1. Before Reference Distance:

- For (d < d_0 ), the path loss increases logarithmically with distance but at a slower rate compared to
after the reference distance.

- A lower path loss exponent (n) indicates a slower decay in signal strength, meaning the signal retains
more power over distance.

2. After Reference Distance:

- For (d > d_0 ), the path loss increases logarithmically with distance at a faster rate.

- A higher path loss exponent n indicates a faster decay in signal strength, meaning the signal weakens
more quickly as the distance increases.

In summary, the path loss exponent n influences the rate at which the signal strength diminishes with
distance. A lower n results in slower decay (favorable for longer-range communication in certain
scenarios), while a higher n results in faster decay, which may be suitable for modeling environments
with significant obstacles and absorption.
Selecting an appropriate path loss exponent is crucial in designing wireless communication systems and
networks to accurately model signal propagation characteristics in a given environment. The choice of n
depends on factors such as the type of environment, frequency, and the presence of obstacles.

Ques no 2:

When k is much less than 0, the primary signal component is relatively feeble in comparison to the
scattered components. In this scenario, the Rician distribution tends toward the Rayleigh distribution as
k diminishes. For instance, when (K = -40 {dB}), a notably negative value, the distribution closely
resembles a Rayleigh distribution.

Conversely, when k is much greater than 0, it implies a robust dominant component in relation to the
scattered components. With increasing k the Rician distribution approaches a Gaussian (normal)
distribution. For example, when (K = -40 {dB}), a considerably positive value, the distribution exhibits
characteristics more akin to a Gaussian distribution.
Ques no 3:

Ques no 4:
Ques no 5:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy