7 To 10
7 To 10
7 To 10
Code:
% Power Delay profile metrices
clear all;
close all;
clc;
L = 4;
Delay = [0, 1, 3, 5];
Gains = [-20, -10, 0, -10];
Gains_linear = 10.^(Gains./10);
Delay_spread = max(Delay) - min(Delay);
disp(Delay_spread);
Summ = sum(Delay .* Gains_linear);
gains_sum = sum(Gains_linear);
Mean_Delay = Summ / gains_sum;
disp(Mean_Delay);
square_root_gains = sqrt(gains_sum);
figure;
stem(Delay, Gains);
xlabel("Delay in us");
ylabel("Gains in dB");
title("PDP Plot");
Output:
Experiment-8
Aim: Simulation of log distance and log normal shadowing path loss model in
MATLAB for different path loss exponent
Code:
% BER for AWGN
clear all;
close all;
clc;
snr = -4:2:10;
snr_linear = 10.^(snr/10);
ber_awgn_exact = qfunc(sqrt(snr_linear));
ber_awgn_approx = 0.5*exp(-snr_linear./2);
ber_rayleigh_exact = (0.5 - 0.5*sqrt(snr_linear./(snr_linear + 2)));
figure;
semilogy(snr, ber_awgn_exact, ':', 'linewidth', 3);
title("AWGN Exact and Approx BER and Rayleigh");
xlabel("SNR (dB)");
ylabel("BER");
hold on;
semilogy(snr, ber_awgn_approx, '--');
hold on;
semilogy(snr, ber_rayleigh_exact, 'g');
legend("AWGN Exact", "AWGN Approx", "Rayleigh Exact");
Output:
Experiment-10
Aim:Simulate the wired as well as wireless communication system in terms
of BER using MATLAB
Code:
% Simulate Wired and Wireless Communication Systems (Binary PAM and BPSK)
clear all;
close all;
clc;
% Parameters
SNR_dB = 0:1:10;
N_bits = 1e5;
M = 2;
Eb = 1;
% Modulation (BPSK)
symbols_bpsk = 2*data - 1; % BPSK modulation
% Initialization
BER_pam = zeros(size(SNR_dB));
BER_bpsk = zeros(size(SNR_dB));
% Noise variance calculation (assuming AWGN channel)
for i = 1:length(SNR_dB)
SNR_linear = 10^(SNR_dB(i)/10);
sigma_pam = sqrt(Eb/(2*SNR_linear));
sigma_bpsk = sqrt(Eb/SNR_linear);
% Plot
figure;
semilogy(SNR_dB,BER_pam,'b-o',SNR_dB,BER_bpsk,'r-o');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
title('Bit Error Rate Comparison for Binary PAM and BPSK');
legend('Binary PAM (Wired)', 'BPSK (Wireless)');
grid on;
Output: