clc;
clear;
close all;
prompt='Is Pt entered in dBw or Watt? Enter dB or W: ';
Pt=input('Enter the Transmiiting Power: ');
inp = input(prompt,'s');
if strcmpi(inp,'W')
Pt = 10*log10(Pt);
disp(Pt);
end
Gt=input('Enter Transmitter Antenna Gain: ');
Gr=input('Enter Reciever Antenna Gain: ');
f=input('Enter Operating Frequency in MHz (150 MHz < f < 2000 MHz): ');
while (f<150 || f>2000)
fprintf(2,'\nFrequency must be between 150 MHz to 1920 MHz\n');
f=input('Enter Operating Frequency in MHz (150 MHz < f < 2000 MHz): ');
end
if (f>1920)
fprintf(2,'\nYou need to use Extended Hata Model (Cost-231)\n');
prompt='\n Medium city (M)\n Suburban Area (S) \n Metropolitan Center (C)\n';
inp = input(prompt,'s');
inp = upper(inp);
for i=150:50:length(f)
Ht=input('BS antenna Height in m (30m<Ht<200m): ');
while (Ht<30 || Ht>200)
fprintf(2,'\nFrequency must be between 3m to 1000m\n');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
end
Hr=input('MS anenna Height in m(1m<Hr<10m): ');
while (Hr<1 || Hr>10)
fprintf(2,'\nReciever Height must be between 1m to 10m\n');
Hr=input('Mobile antenna Height in m (1m<Hr<10m): ');
end
d=input('Distance bt Tx and Rx in Km (1Km<d<20Km) : ');
while (d<1 || d>20)
fprintf(2,'\nDistance must be between 1Km to 20Km\n');
d=input('Distance bt Tx and Rx in Km (1Km<d<20 Km): ');
end
if strcmp(inp,'M')
for i=150:50:length(f)
cm=0;
ahr=(1.1*log10(f(i))-0.7)*Hr-1.56*log10(f(i))-0.8;
L(i)=46.3+33.9*log10(f(i))-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
end
plot(f,L)
elseif strcmp(inp,'S')
for i=150:50:length(f)
cm=1;
ahr=(1.1*log10(f(i))-0.7)*Hr-1.56*log10(f(i))-0.8;
L(i)=46.3+33.9*log10(f(i))-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
end
plot(f,L)
else
for i=150:50:length(f)
cm=3;
ahr=3.2*(log10(11.75*Hr))^2-4.97;
L(i)=46.3+33.9*log10(f(i))-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
end
plot(f,L)
end
end
elseif (f>1500 && f<=1920)
fprintf(2,'\nYou need to use Okumura Model or Extended Hata Model (Cost-231)\n');
prompt = 'Which Model do you intend to use? (Insert O for Okumora or E for Exctended Hata (Cost-231)';
inp = input(prompt,'s');
inp = upper(inp);
if strcmp(inp,'O')
warning('Okumora Model is selceted')
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
while (Ht<30 || Ht>1000)
fprintf(2,'\nFrequency must be between 3m to 1000m\n');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
end
Hr=input('MS anenna Height in m(3m<Hr<10m): ');
while (Hr<3 || Hr>10)
fprintf(2,'\nReciever Height must be between 30m to 100m\n');
Hr=input('Mobile antenna Height in m (30m<Ht<1000m): ');
end
d=input('Distance bt Tx and Rx in Km (1Km<d<100 Km) : ');
while (d<1 || d>100)
fprintf(2,'\nDistance must be between 30m to 100m\n');
d=input('Distance bt Tx and Rx in Km (1Km<d<100 Km): ');
end
Amu=input('Enter the Median Attenuation in dB: ');
Ga=input('Enter Correction Factor due to environment type: ');
Kter=input('Correction factor on Rolling Hilly Terain (Undulation): ');
Ksp=input('Correction Factor on Sloping Terrain');
Kls=input('Correction factor on Land Sea Terrain');
Lf=32.45+20*log(f)+20*log10(d);
GHt=20*log(Ht/200);
if(Hr>3)
GHr=20*log10(Hr/3);
else
GHr=10*log10(Hr/3);
end
else
fprintf(2,'\nYou need to use Extended Hata Model (Cost-231)\n');
prompt='\n Medium city (M)\n Suburban Area (S) \n Metropolitan Center (C)\n';
inp = input(prompt,'s');
inp = upper(inp);
Ht=input('BS antenna Height in m (30m<Ht<200m): ');
while (Ht<30 || Ht>200)
fprintf(2,'\nFrequency must be between 3m to 1000m\n');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
end
Hr=input('MS anenna Height in m(1m<Hr<10m): ');
while (Hr<1 || Hr>10)
fprintf(2,'\nReciever Height must be between 30m to 100m\n');
Hr=input('Mobile antenna Height in m (30m<Ht<1000m): ');
end
d=input('Distance bt Tx and Rx in Km (1Km<d<20Km) : ');
while (d<1 || d>20)
fprintf(2,'\nDistance must be between 1Km to 20Km\n');
d=input('Distance bt Tx and Rx in Km (1Km<d<20 Km): ');
end
if strcmp(inp,'M')
cm=0;
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=46.3+33.9*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
elseif strcmp(inp,'S')
cm=1;
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=46.3+33.9*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
else
cm=3;
ahr=3.2*(log10(11.75*Hr))^2-4.97;
L=46.3+33.9*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
end
end
L=Lf+Amu-GHt-GHr-Ga;
disp(L)
plot(Hr,L);
title('Frequency versus Loss in dB for suburben area using Ukumara Model ');
xlabel('Frequency in MHz');
ylabel('Path Loss in dB');
else
prompt = 'Which Model do you intend to use? (Insert O for Okumora or H for Hata or E for Extended Hata(Cost-231))';
inp = input(prompt,'s');
inp = upper(inp);
if strcmp(inp,'O')
warning('Okumora Model is selceted');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
while (Ht<30 || Ht>1000)
fprintf(2,'\nFrequency must be between 3m to 1000m\n');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
end
Hr=input('MS anenna Height in m(3m<Hr<10m): ');
while (Hr<3 || Hr>10)
fprintf(2,'\nReciever Height must be between 30m to 100m\n');
Hr=input('Mobile antenna Height in m (30m<Ht<1000m): ');
end
d=input('Distance bt Tx and Rx in Km (1Km<d<100 Km) : ');
while (d<1 || d>100)
fprintf(2,'\nDistance must be between 30m to 100m\n');
d=input('Distance bt Tx and Rx in Km (1Km<d<100 Km): ');
end
Amu=input('Enter the Median Attenuation in dB: ');
Ga=input('Enter Correction Factor due to environment type: ');
Kter=input('Correction factor on Rolling Hilly Terain (Undulation): ');
Ksp=input('Correction Factor on Sloping Terrain');
Kls=input('Correction factor on Land Sea Terrain');
Lf=32.45+20*log(f)+20*log10(d);
GHt=20*log10(Ht/200);
if(Hr>3)
GHr=20*log(Hr/3);
else
GHr=10*log10(Hr/3);
end
L=Lf+Amu-GHt-GHr-Ga;
disp(L)
plot(Hr,L);
title('Frequency versus Loss in dB for suburban area using Ukumara Model ');
xlabel('Frequency in MHz');
ylabel('Path Loss in dB');
grid on;
elseif strcmp(inp,'H')
fprintf(2,'\n Hata Model is selected \n');
Ht=input('Basestaion anenna Height in m(3m<Hr<1000m): ');
while (Ht<30 || Ht>1000)
fprintf(2,'\nFrequency must be between 3m to 1000m\n');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
end
Hr=input('MS anenna Height in m(3m<Hr<10m): ');
while (Hr<3 || Hr>10)
fprintf(2,'\nReciever Height must be between 30m to 100m\n');
Hr=input('Mobile antenna Height in m (30m<Ht<1000m): ');
end
d=input('Distance bt Tx and Rx in Km (1Km<d<200 Km) : ');
while (d<1 || d>200)
fprintf(2,'\nDistance must be between 30m to 200m\n');
d=input('Distance bt Tx and Rx in Km (1Km<d<100 Km): ');
end
prompt=' Which area is targeted? \n Small or Medium Sized City? (M) \n Large City (L)\n Suburban area (S) \n Open rural area(O) \n';
inp=input(prompt,'s');
inp = upper(inp);
if strcmp(inp,'S')
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=68.55+26.16*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Ht))*log10(d);
elseif strcmp(inp,'L')
if (f>=300)
ahr=8.9*(log10(1.54*Hr))^2-1.1;
L=68.55+26.16*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Ht))*log10(d);
else
ahr=3.2*(log10(11.75*Hr))^2-4.97;
end
L=68.55+26.16*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Ht))*log10(d);
elseif strcmp(inp,'S')
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=68.55+26.16*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log(Ht))*log10(d)-2*(log10(f/28))^2-5.4;
elseif strcmp(inp,'O')
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=68.55+26.16*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Ht))*log10(d)-4.78*(log10(f))^2-18.33*log10(f)-40.98;
end
else
prompt='\n Medium city (M)\n Suburban Area (S) \n Metropolitan Center (C)\n';
inp = input(prompt,'s');
inp = upper(inp);
Ht=input('BS antenna Height in m (30m<Ht<200m): ');
while (Ht<30 || Ht>200)
fprintf(2,'\nFrequency must be between 3m to 1000m\n');
Ht=input('BS antenna Height in m (30m<Ht<1000m): ');
end
Hr=input('MS anenna Height in m(1m<Hr<10m): ');
while (Hr<1 || Hr>10)
fprintf(2,'\nReciever Height must be between 30m to 100m\n');
Hr=input('Mobile antenna Height in m (30m<Ht<1000m): ');
end
d=input('Distance bt Tx and Rx in Km (1Km<d<20Km) : ');
while (d<1 || d>20)
fprintf(2,'\nDistance must be between 1Km to 20Km\n');
d=input('Distance bt Tx and Rx in Km (1Km<d<20 Km): ');
end
if strcmp(inp,'M')
cm=0;
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=46.3+33.9*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
elseif strcmp(inp,'S')
cm=1;
ahr=(1.1*log10(f)-0.7)*Hr-1.56*log10(f)-0.8;
L=46.3+33.9*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
else
cm=3;
ahr=3.2*(log10(11.75*Hr))^2-4.97;
L=46.3+33.9*log10(f)-13.82*log10(Ht)-ahr+(44.9-6.55*log10(Hr))*log10(d)+cm;
end
end
end