0% found this document useful (0 votes)
15 views20 pages

Mains

The document contains a series of MATLAB programs authored by Chinmay Kulkarni, focusing on various telecommunications concepts such as path loss modeling, bit error rate analysis for BPSK modulation, and Doppler shift calculations. Each program includes input parameters, calculations, and plots to visualize the results related to signal processing and communication systems. The document serves as a practical demonstration of theoretical concepts in wireless communication.

Uploaded by

Chinmay Kulkarni
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)
15 views20 pages

Mains

The document contains a series of MATLAB programs authored by Chinmay Kulkarni, focusing on various telecommunications concepts such as path loss modeling, bit error rate analysis for BPSK modulation, and Doppler shift calculations. Each program includes input parameters, calculations, and plots to visualize the results related to signal processing and communication systems. The document serves as a practical demonstration of theoretical concepts in wireless communication.

Uploaded by

Chinmay Kulkarni
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/ 20

NAME : CHINMAY KULKARNI

ROLL NO : 41

PROGRAM :

clc;

clear all;

%----------Input Section---------------

Hbts = 40; %Height measured from the base of the BTS tower to the radiation centerline

Tbts = 350; %Terrain elevation at the location of the BTS

Htav = 300; %Height of the average terrain (from 3 Km to 15 km distance from the BTS)

Hm = 2; %Height of the mobile antenna in meters

f = 2100; %100:100:3000; %Range of frequencies in MHz

d = 0.5:0.5:15; %Range of Tx-Rx separation distances in Kilometers

Pt = 0.020; %Power transmitted by the BTS antenna in Watts

Gt = 10; %BTS antenna gain in dBi

%--------------------------------------

Hb = Hbts + Tbts - Htav; %Effective Height of the BTS antenna in meters

C = 0;

aHm = 3.2 * (log10(11.75 * Hm)) ^ 2 - 4.97;

A = 69.55 + 26.16 * log10(f) - 13.82 * log10(Hb) - aHm;

B = 44.9 - 6.55 * log10(Hb);

PL = A + B * log10(d) + C;

subplot(2, 1, 1)

plot(d, PL, 'r', 'LineWidth', 2);

title('Hata-Okumura Path Loss Model', 'Fontsize',20);

xlabel('Distance - Kilometers', 'Fontsize',16);

ylabel('Path Loss (dB)', 'Fontsize',16);

%Compute Received Signal Level

Pr = 10 * log10(Pt * 1000) + Gt – PL
subplot(2, 1, 2)

plot(d, Pr, 'r', 'LineWidth', 2);

title('Hata-Okumura Model', 'Fontsize',20);

xlabel('Distance - Kilometers', 'Fontsize',16);

ylabel('Received Signal Level (dBm)', 'Fontsize',16);

OUTPUT:
NAME : CHINMAY KULKARNI

ROLL NO : 41

PROGRAM :-

% Demonstration of Eb/N0 Vs BER for BPSK modulation scheme

clc;

clear all;

N=1000000; %No. of bits within which error bits are to be calculated

SNRdb=0:1:50; %Given Data

SNR= 10.^(SNRdb/10); %SNR In dB

BER= qfunc((SNR).^0.5); % Use of Q in BPSK

BERdb=10*log10(BER); %Bit Error Rate In decibel

BERdb_perbit=BERdb/N; % Bit Error Rate per bit

plot(SNRdb,BERdb_perbit,'b');

xlabel('SNR in Decibel');

ylabel('BER in Decibel');

grid on;

OUTPUT:
NAME : CHINMAY KULKARNI

ROLL NO : 41

PROGRAM: Consider,

𝑚𝑜𝑚𝑒𝑛𝑡_1 = ∫ 𝜙(𝜏) 𝜏 𝑑𝜏
−∞

𝑚𝑜𝑚𝑒𝑛𝑡_2 = ∫ 𝜙(𝜏)(𝜏 − 𝜏̅)2 𝑑𝜏
−∞

Define new function, File→New Function→meas_continuous_PDP


function[meanDelay,rmsDelay,symbolRate,coherenceBW]=meas_continuous_PDP(fun,lowerLim,upperLim)

%FunctiontocalculatemeanDelay,RMSdelayspread,maximumsymbol

%ratethatasignalcanbetransmittedwithoutISIandthecoherence

%BWforthePDPequationspecifiedasfunctionhandle(fun)

%example:fun=@(tau)exp(-tau/0.00001);%givenPDPequation

%lowerLim-lowerlimitforintegration

%upperLim-upperlimitforintegration

moment_1=@(x)x.*fun(x);

meanDelay=integral(moment_1,lowerLim,upperLim)/integral(fun,lowerLim,upperLim);

moment_2=@(y)((y-meanDelay).ˆ2).*fun(y);

rmsDelay=sqrt(integral(moment_2,lowerLim,upperLim)/integral(fun,lowerLim,upperLim));

symbolRate=1/(10*rmsDelay);%maximumsymbolratetoavoidISI

coherenceBW=1/(50*rmsDelay);%for0.9correlation

%coherenceBW=1/(5*rmsDelay);%for0.5correlation

Endfunction

Run following script after saving above function in a file.

fun = @(tau)2*exp(-tau/1e-6);

[meanDelay,rmsDelay,symbolRate,coherenceBW] = meas_continuous_PDP(fun,0,10e-6);

tau = [0:0.01e-6:5e-6];

fun1 = 2*exp(-tau/1e-6);

plot (tau, fun1, 'r', 'LineWidth', 2);

title ('Power vs Delay', 'Fontsize',20);

xlabel ('Delay', 'Fontsize',16);

ylabel('Power(dBm)', 'Fontsize',16);
OUTPUT:
NAME : CHINMAY KULKARNI

ROLL NO : 41

PROGRAM:

clc;
close all;
clear all;
pt=input('enter the input power in watts:');
Pt=10*log10(pt) %calculating transmitted power in db
gt=input('enter the transmitting antenna gain in db:');
gs=input('enter the receiving antenna gain in db:');
EIRP=Pt+gt %calculating EIRP
d=input('enter the distance in km:');
f=input('enter the frequency in mhz:');
fsl=32.4+20*log10(d)+20*log10(f) %calculating path loss
rfl=input('enter the receiver feeder loss in db:');
aa=input('enter the atmospheric absorption in db:');
aml=input('enter the antenna misalignment loss in db:');
pl=input('enter the polarization loss in db:');
losses=fsl+rfl+aa+aml+pl; %calculating total losses
disp(sprintf('%s %f %s','total loss',losses,'db'));
P=EIRP+gs-losses; %calculating power recieved
P_watt = 10^(P/10);
disp(sprintf('%s %f %s','Total received power =',P_watt,'W'));
OUTPUT:
NAME : CHINMAY KULKARNI

ROLL NO : 41

PROGRAM:
clear

N = 10^6; % number of bits or symbols

Eb_N0_dB = [0:25]; % multiple Eb/N0 values

nTx = 2;

nRx = 2;

for ii = 1:length(Eb_N0_dB)

% Transmitter

ip = rand(1,N)>0.5; % generating 0,1 with equal probability

s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0

sMod = kron(s,ones(nRx,1)); %

sMod = reshape(sMod,[nRx,nTx,N/nTx]); % grouping in [nRx,nTx,N/NTx ] matrix

h = 1/sqrt(2)*[randn(nRx,nTx,N/nTx) + j*randn(nRx,nTx,N/nTx)]; % Rayleigh channel

n = 1/sqrt(2)*[randn(nRx,N/nTx) + j*randn(nRx,N/nTx)]; % white gaussian noise, 0dB variance

% Channel and noise Noise addition

y = squeeze(sum(h.*sMod,2)) + 10^(-Eb_N0_dB(ii)/20)*n;

% Receiver

% Forming the Zero Forcing equalization matrix W = inv(H^H*H)*H^H

% H^H*H is of dimension [nTx x nTx]. In this case [2 x 2]

% Inverse of a [2x2] matrix [a b; c d] = 1/(ad-bc)[d -b;-c a]

hCof = zeros(2,2,N/nTx) ;

hCof(1,1,:) = sum(h(:,2,:).*conj(h(:,2,:)),1); % d term

hCof(2,2,:) = sum(h(:,1,:).*conj(h(:,1,:)),1); % a term

hCof(2,1,:) = -sum(h(:,2,:).*conj(h(:,1,:)),1); % c term

hCof(1,2,:) = -sum(h(:,1,:).*conj(h(:,2,:)),1); % b term


hDen = ((hCof(1,1,:).*hCof(2,2,:)) - (hCof(1,2,:).*hCof(2,1,:))); % ad-bc term

hDen = reshape(kron(reshape(hDen,1,N/nTx),ones(2,2)),2,2,N/nTx); % formatting for division

hInv = hCof./hDen; % inv(H^H*H)

hMod= reshape(conj(h),nRx,N); % H^H operation

yMod = kron(y,ones(1,2)); % formatting the received symbol for equalization

yMod = sum(hMod.*yMod,1); % H^H * y

yMod= kron(reshape(yMod,2,N/nTx),ones(1,2)); % formatting

yHat = sum(reshape(hInv,2,N).*yMod,1); % inv(H^H*H)*H^H*y

% receiver - hard decision decoding

ipHat = real(yHat)>0;

% counting the errors

nErr(ii) = size(find([ip- ipHat]),2);

end

simBer = nErr/N; % simulated ber

EbN0Lin = 10.^(Eb_N0_dB/10);

theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));

p = 1/2 - 1/2*(1+1./EbN0Lin).^(-1/2);

theoryBerMRC_nRx2 = p.^2.*(1+2*(1-p));

close all

figure

semilogy(Eb_N0_dB,theoryBer_nRx1,'bp-','LineWidth',2);

hold on

semilogy(Eb_N0_dB,theoryBerMRC_nRx2,'kd-','LineWidth',2);

semilogy(Eb_N0_dB,simBer,'mo-','LineWidth',2);

axis([02510^-50.5])

grid on

legend('theory (nTx=1,nRx=1)', 'theory (nTx=1,nRx=2, MRC)', 'sim (nTx=2, nRx=2, ZF)');


OUTPUT:
NAME: Chinmay Kulkarni

ROLL NO: 41

PROGRAM:

Nt = 2; % No. of transmit antennas

Nr = 2; % No. of receive antennas

No = 1; % Noise variance

y = input('Enter received signal coefficients at the detector = ');

s = 2*randi([0 1],Nt,1) - 1; % Binary transmitted symbols

%H = (randn(Nr,Nt) + 1*i*randn(Nr,Nt))/sqrt(2) % Channel coefficients

%disp ('Channel coefficients are:');

%disp(H);

noise = sqrt(No/2)*(randn(Nr, 1) + 1*i*randn(Nr,1 )); % AWGN noise

%y = H*s + noise; % Inputs to the detectors

H = (y - noise) / s ;

disp(' The channel coefficients are: ');

disp(H);

OUTPUT:
NAME: Chinmay Kulkarni

ROLL NO : 41

PROGRAM:-

clc;

clear all;

speed = input('Enter the moving vehicle speed in miles per hour: ');

theta = input ('Enter the angle of vehicle with the line joining the base station: ');

carrier = input ('frequency over which Doppler shift is to be observed (in Hz): ');

fprintf('1. mobile user is moving towards the base station \n2. mobile user is moving
away from the base station\n');

movement = input('Enter appropriate scenario: ');

speed_m = speed * 1.61 * 5 / 18;

speed_m

fd = speed_m * cosd(theta) * carrier / (3 * 10^8) ;

fprintf('The Doppler shift is fd = %d.\n', fd);

switch movement

case 1

fprintf ('Since the mobile user is moving towards the base station, the Doppler shift is
positive, i.e., the perceived frequency fr = %dHz + %dHz\n', carrier, fd);

case 2

fprintf ('Since the mobile user is moving away the base station, the Doppler shift is
positive, i.e., the perceived frequency fr = %dHz - %dHz\n', carrier, fd);

end
OUTPUT:
NAME : Chinmay Kulkarni

ROLL NO : 41

PROGRAM:
clc;

clear all;

A = 38.4;

ch = input('Enter number of channels = ');

pb = input('Enter the blocking probability = ');

city_area = input('Enter city area in km2 = ');

radius = input('Enter the multiple values of radius (in km) = ');

%38.4, supported traffic for 48 channels and pb = 0.02, from Erlang Traffic table

cell_users = A/pb ;

cell_area = radius .* (6 * (1/sqrt(3))) ;

cell_numbers = fix (city_area./cell_area) ;

supported_users = cell_numbers * cell_users ;

plot(radius,supported_users);

plot(radius,supported_users);

title('Number of Users with 2% Pb');

xlabel('Radius in km');

ylabel('supported Users');

You might also like