Can anybody please explain this script? How that excel file is using for calculation?
12 次查看(过去 30 天)
显示 更早的评论
%%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)');
0 个评论
回答(1 个)
Walter Roberson
2017-11-20
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 个评论
Walter Roberson
2017-11-20
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!