Clear Filters
Clear Filters

Can anybody please explain this script? How that excel file is using for calculation?

2 views (last 30 days)
%%Clean up cell
clc; % clears the command window
clear ; % clears all variables, but not figures
close all; % closes all figure windows
%%Defining all required parameters
Pc = 20; % Power per carrier
n = 8; % Number of carriers
Ptx = Pc * n; % Hatchplate Power [W]
Loss = 3; % Cable loss [db]
acl = 25; % Antenna centerline [m]
downtilt = 0; % Mechanical downtilt [degrees]
Targeth = 2; % Height of the human [m]
%%Plotting the terrain profile
x1 = -35:0.001:3;
x2 = 3.001:0.001:25;
x3 = 25.001:0.001:100;
x4 = 100.001:0.001:160;
% Values of slope for all the slope equations
m1 = 0;
m2 = 0;
m3 = 0.133333;
m4 = -0.02;
% Values of constant for all the slope equations
c1 =15;
c2 =0;
c3 =0;
c4 =10;
% Slope equations
y1 = m1.*(x1)+c1;
y2 = m2.*(x2-10)+c2;
y3 = m3.*(x3-25)+c3;
y4 = m4.*(x4-100)+c4;
% Plotting the terrain profile
x=[x1 x2 x3 x4]';
y=[y1 y2 y3 y4]';
figure(1)
plot(x,y); % Plotting the Ground elevation vs distance
ylim([0 25]);
xlabel('Distance [m]');
ylabel('Ground Elevation');
title('Ground Elevation vs distance (m)');
%%Define height above the ground for Angle of Depression from the Antenna
h1 = acl-y-Targeth; % Calculating the required height [m]
R = hypot(h1,x); % Calculating R using Pythagoreas Theorem [m]
%%Calculating the angle
angle_d1 = -(atan2d(h1,x))+downtilt; % Angle of depression
%%Getting Vertical angle file data
h = xlsread('Parth.xlsx');
%%Converting power from dbd to Watts
L1 = 10.^(Loss/10); % Converting Loss from db to Watts
P1= Ptx / L1; % Power of Tx [W]
%%Gain calculaion
G1d = interp1(h(:,1),h(:,2),angle_d1); % Gain in db
G2i = G1d + 2.15; % Gain in dbi
Ga1 = 10.^(G2i./10); % Tx gain in dbi
%%Calculating power density
EIRP1 = P1 .* Ga1; % Effective Isotropic Power [W]
Pd1 = (P1 .* Ga1)./(4 .* pi .* (R.^2)); % Power density [mW/square-cm]
Pd = Pd1./10;
figure(2)
plot(x,Pd); % Plotting the Power density vs distance graph
xlabel('Distance [m]');
ylabel('Power density [mW/sq.cm]');
title('Power density [mW/sq.cm] vs distance (m)');

Answers (1)

Walter Roberson
Walter Roberson on 20 Nov 2017
The file Parth.xlsx is expected to contain at least 2 columns. The first column is expected to contain a list of angles, and the second column is expected to contain a list of the corresponding gain (in db)
  2 Comments
Parth Panchal
Parth Panchal on 20 Nov 2017
ok that make sense but can you explain me this function>
G1d = interp1(h(:,1),h(:,2),angle_d1);
Walter Roberson
Walter Roberson on 20 Nov 2017
h(:,1) is the list of angles from the xlsx file. h(:,2) is the list of corresponding gains. The interp1() call says to use that known information to predict the gain at every angle given in the angle_d1 vector. Because no other options are used in the interp1() call, by default linear interpolation is used.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!