SlideShare a Scribd company logo
1 of 22
Download to read offline
MSOE MEMO
To: [Dr. Tritt]
From: Simon, Nikolas A.
Date: February 16, 2016
Re: [Project (trilat2d.m,sort_pr.m,power_to_d_friis.m,distance_confirm.m,power_to_xy.m,circle.m,testscript.m) ]
Program Description:
This program serves at the main calculation tool for a more complex location tracking system. This
location tracking system seeks to determine the location of a node based on received power levels from
a fixed grid of beacons. The location tracking system is implemented such that the beacons are ceiling
mounted and the node can move in XY directions on the floor below. These beacons are strategically
placed in a 3 by 3 grid and are tagged such that it is clear from the program input which power level is
which. Each beacon broadcasts message payloads containing beacon number and a power level in units
of dBm. The node detects the associated RSSI (receives signal strength indicator) values of these
beacons which means each beacon in the grid has an identifying label and an associated received power
level from the perspective of the node.
The power values are stored in a list from 1 to 9 where they are then sorted into the three highest
power levels. Expected RSSI received input power levels are between 0 and -120 dBm. The known level
of transmit power Pt for all beacons is in the grid is approximately +10dbm. The known gains of the
transmit and receive antennas on the beacons and nodes are 9.6899 dB.
A method called trilateration is used to calculate the unknown node coordinate. Trilateration
determines an unknown location from multiple reference locations. The distances relative to these
reference locations are used to estimate the coordinate of the unknown location. At least three
reference locations must exist for trilateration to be implemented. If three reference locations are
considered, the origin of each reference location can be considered the center of a sphere where the
unknown location is the intersection of all three spheres.
For the trilateration calculation to work correctly, at least three beacon received power levels must be
known to determine the unknown location of the node in 2 dimensions. Because the node is
constrained to XY coordinates and can not move freely in the Z direction, a constant is introduced to
account for the difference in distance between the ceiling mounted beacons and the ground node in the
physical implementation of the program.
Equations of Interest:
Wavelength:
ߣ =
ܿ
݂
Equation 1: Wavelength relates the speed of light to a desired frequency
‫ܦ‬ଶ
= ‫ܣ‬ଶ
+ ‫ܤ‬ଶ
+ ‫ܥ‬ଶ
Equation 2: 3d Pythagorean Theorem considers the Z direction
ܲ௥
ܲ௧
= ‫ܩ‬௧‫ܩ‬௥ ൬
ߣ
4ߨܴ
൰
ଶ
Equation 3: Friis Equation relating received power, transmitted power, transmit/receive antenna gains,
wavelength, and range in an inverse square relationship of the three highest power levels
When solved for distance:
→ ݀ =
ߣ
4ߨ	
ඨ
ܲ௥
ܲ௧
‫ܩ‬௥‫ܩ‬௧
	
	
ܲ௅ =
ܲ௧
ܲ௥
Equation 4: Linear path loss ratio which related transmitted power to received power. Path loss can be
determined by taking the ratio of transmitted power to received power. Depending on changes to the
orientation of the test environment, this value will change.
ܲ௥ = ܲ௧ + 20 log ൬
ߣ
4ߨ
൰ + 10݈݊‫݃݋‬ ൬
1
݀
൰
Equation 5: Equation for received power using the signal decay exponent which represents
environmental characterization
݊ =
ܲ௥ሺௗ଴ሻ − ܲ௥ሺௗሻ
10 logଵ଴ ൬
݀
݀଴
൰
Equation 6: Environmental calibration equation for the signal decay exponent where ܲ௥ሺௗ଴ሻ is a
reference received power level at 1 meter away from the source and ܲ௥ሺௗሻ is the received power level at
a distance d away from the source
Solving for d:
→ 10݊ሾlogଵ଴ሺ݀ሻ − logଵ଴ሺ݀଴ሻሿ = ܲ௥ሺௗ଴ሻ − ܲ௥ሺௗሻ
→ logଵ଴ሺ݀ሻ =
ܲ௥ሺௗ଴ሻ − ܲ௥ሺௗሻ + 10݈݊‫݃݋‬ଵ଴ሺ݀଴ሻ
10݊
→ ݀ = 10
൤
௉ೝሺ೏బሻି௉ೝሺ೏ሻାଵ଴௡௟௢௚భబሺௗబሻ
ଵ଴௡
൨
However exponential calculations like this can be computationally intensive and cause lag time in a
program implementation. To reduce computation time, the distance is calculated with a series
expansion to the needed accuracy.
݀ = ݀଴ ቂ1 +
௞
ଵ!
+
௞
ଶ!
+
௞
ଷ!
+
௞
ସ!
+
௞
ହ!
+ ⋯ ቃ			, ݇ =
୪୬ሺଵ଴ሻሾ௉ೝሺ೏బሻି௉ೝሺ೏ሻሿ
ଵ଴௡
Received power can be determined with the environmental calibration equation which is dependent on
the signal decay exponent and with the Friis equation which is dependent on knowing the gains of the
transmit and receive antennas. Being able to calculate received power in two different ways allows for a
method of error checking because gain is not dependent on the signal decay exponent, it is a physical
characteristic of the antenna:
→ ‫ܩ‬௥ =
4ߨ‫ܣ‬௘
ߣଶ
Receiver gain equation where Ae represents effective aperture (area covered by the transmitter).
→ ‫ܣ‬௘ =
ܲ௧
ܲௗ
The effective aperture is a function of power density Pd.
→ ܲௗ 	൤
ܹ
݉ଶ൨ =
ܲ௧‫ܩ‬௧
4ߨ݀
Power density is a function of transmit gain.
When comparing the Friis distance values and the signal decay exponent distance values, they are no
more than 1 meter apart from each other for any given calculation. Any more than this would indicate a
calculation error.
Simple 2d Trilateration Equations:
݀ଵ
ଶ
= ሺ‫ݔ‬ଵ − ‫ݔ‬ሻଶ
+ ሺ‫ݕ‬ଵ − ‫ݕ‬ሻଶ
݀ଶ
ଶ
= ሺ‫ݔ‬ଶ − ‫ݔ‬ሻଶ
+ ሺ‫ݕ‬ଶ − ‫ݕ‬ሻଶ
݀ଷ
ଶ
= ሺ‫ݔ‬ଷ − ‫ݔ‬ሻଶ
+ ሺ‫ݕ‬ଷ − ‫ݕ‬ሻଶ
Equation Set 7:	݀ଵ,ଶ,ଷ represents the distances between the reference beacons and the target unknown
node solved for with the Pythagorean Theorem.
‫ݔ‬ =
‫ܻܣ‬ଷଶ + ‫ܻܤ‬ଵଷ + ‫ܻܥ‬ଶଵ
2ሺ‫ݔ‬ଵ‫ݕ‬ଷଶ + ‫ݔ‬ଶ‫ݕ‬ଵଷ + ‫ݔ‬ଷ‫ݕ‬ଶଵሻ
‫ݕ‬ =
‫ܺܣ‬ଷଶ + ‫ܺܤ‬ଵଷ + ‫ܺܥ‬ଶଵ
2ሺ‫ݕ‬ଵ‫ݔ‬ଷଶ + ‫ݕ‬ଶ‫ݔ‬ଵଷ + ‫ݕ‬ଷ‫ݔ‬ଶଵሻ
Where:
‫ܣ‬ = ‫ݔ‬ଵ
ଶ
+ ‫ݕ‬ଵ
ଶ
− ݀ଵ
ଶ
‫ܤ‬ = ‫ݔ‬ଶ
ଶ
+ ‫ݕ‬ଶ
ଶ
− ݀ଶ
ଶ
‫ܥ‬ = ‫ݔ‬ଷ
ଶ
+ ‫ݕ‬ଷ
ଶ
− ݀ଷ
ଶ
Equation Set 8: The system of Pythagorean equations is used to solve for the unknown x and y
coordinates which refer to ܶሺ‫,ݔ‬ ‫ݕ‬ሻ in figure 1. The notation ܺ௔௕ and ܻ௔௕ means ሺ‫ݔ‬௔ − ‫ݔ‬௕ሻandሺ‫ݕ‬௔ − ‫ݕ‬௕ሻ.
Figure 1: Diagram of trilateration using three known reference points to determine an unknown
coordinate at the intersection of all three radii. Rଵ,ଶ,ଷ represent the coordinates of the reference
locations.
When adjusting for the fact that the node and beacons are not in the same plane, a Z component must
be introduced into the trilateration equations so the 3d form of the Pythagorean Theorem must be used
for in the system of Pythagorean equations. The z value is always a constant in the implementation,
there is no z direction so it is assumes that the mobile node cannot move freely in the z direction:
݀ଵ
ଶ
= ሺ‫ݔ‬ଵ − ‫ݔ‬ሻଶ
+ ሺ‫ݕ‬ଵ − ‫ݕ‬ሻଶ
+ ሺ‫ݖ‬ሻଶ
݀ଶ
ଶ
= ሺ‫ݔ‬ଶ − ‫ݔ‬ሻଶ
+ ሺ‫ݕ‬ଶ − ‫ݕ‬ሻଶ
+ ሺ‫ݖ‬ሻଶ
݀ଷ
ଶ
= ሺ‫ݔ‬ଷ − ‫ݔ‬ሻଶ
+ ሺ‫ݕ‬ଷ − ‫ݕ‬ሻଶ
+ ሺ‫ݖ‬ሻଶ
There is no dependence in the z direction therefore the equation for Z reduces to Z=Z.
Program Inputs:
Received beacon power levels 1 to 9
Program Outputs:
X Y coordinates of unknown location, linear path loss, d error rate, power density, effective aperture
Intermediate Values:
PA: highest received power level
PB: second highest received power level
PC: third highest received power level
D1: transmit radius of beacon with the highest received power level
D2: transmit radius of beacon with the second highest received power level
D3: transmit radius of beacon with the third highest received power level
X1,Y1 : grid coordinates of the beacon with the highest received power level
X2,Y2 : grid coordinates of the beacon with the second highest received power level
X3,Y3 : grid coordinates of the beacon with the third highest received power level
Constants:
λ: 0.3279m wavelength equal to
௖
௙
where c is the speed of light and f is the desired center frequency of
915MHz
Gt: 9.6899dB, transmit antenna gain
Gr: 9.6899dB , receive antenna gain
Pt: ≈+10dbM , transmit power
Prd0: 1 dBm, reference received power level at 1m
H: vertical distance from node to ceiling mounted beacons
Discussion of Algorithm:
The user enters a list of 9 received power values in units of dBm. From 1 to 9 each number corresponds
with a fixed position in the 3x3 grid of beacons. The entered values are then sorted into the highest
three values, making sure to keep track of each power value’s specific location number. The three
highest power levels are then entered into the power distance relationship described by the Friis
equation. The three highest power levels must also determine the three individual XY coordinates
belonging to the three highest received power signals. These three results must then be weighted by
power strength to properly align the unknown node coordinate within the triangle of possible area
between the three highest received beacon power levels.
Figure 2: Illustration of possible position within three selected beacon locations. Based on highest,
middle, and lowest power level a weighting is applied which places the coordinate closer to the beacons
which output the highest power. This weighting affects the distance component of the calculations.
The three highest power levels must be processed and converted to three distinct XY coordinates
representing each beacon location. A point to point mapping of the beacon layout is predefined and
Cartesian coordinates are assigned to each beacon.
Figure 3: Mapping to Cartesian coordinates
In the original brainstorming of the algorithm development matrices were considered for data
processing and grid mapping. Storing values in matrices serves to further complicate the design
unnecessarily and the use of matrix calculations would increase calculation time which may affect
response time when the program is deployed.
Program Functions:
1) Sort Received Powers(sort_pr.m)
Inputs: 9 Pr values in units of dBm
Saves inputs to a structure and sorts out the three highest values and their associated beacon number
Outputs: 3 greatest Pr values in the possible range of between 0 and -120 dBm, and their associated
beacon number
H
LM
2) Coordinate Mapping(power_to_xy.m)
Inputs: beacon number associated with 3 highest Pr values
Maps beacon number to Cartesian in the pattern described in Figure 3.
Outputs: x y coordinates for each of the three beacons
3) Power to distance conversion(power_to_d_friis.m)
Inputs: three highest power levels
Implementation of Equation 3
Outputs: three distances representing the radius of each reference point for trilateration
4) Error Checking(distance_confirm.m)
Inputs: 3 highest received powers, reference received power
The second method for distance calculation to compare with the results from the first distance
calculation (implementation of the series form of Equation 5).
Outputs: 3 distances representing the radius of each reference point for trilateration
5) Trilateration(trilat2d.m)
Inputs: x y coordinates of the three reference beacons, distances of each reference point
Implementation of trilateration equations
Outputs: unknown x y coordinate
6) Calculation Plotting(circle.m)
Inputs: x y coordinates and d for each reference location, the unknown coordinate, plot formatting
Plots reference points and the circle representing their individual distances represented in Figure 1 as
well as the unknown coordinate with the plot text function
Outputs: figure displaying unknown coordinate graphically
7) Test Fixture(testscript.m)
Inputs: User entered received power values
Calls all of the previously described functions and prompts the user for input data in the command
window.
Outputs: Figure displaying calculation results graphically
Figure 4: Concept flow diagram of program operation
Error Detection:
The radii represented by the three distances must also intersect for all three beacon locations. This can
be tested geometrically by comparing distances based on the origin of each beacon where overlap
indicates a successful basis for trilateration.
Figure 5: Illustration of all three radii not intersecting indicating that a valid trilateration calculation
cannot be performed
Due to the fact that received power can be calculated in two different ways (by knowing the gain, and by
knowing the signal decay exponent), program inputs can be checked for validity. The system equipment
uses 915MHz patch antennas with a gain of 9.6899 dB and the expected path loss exponent for line of
sight is approximately 1.7 .
RSSI is influenced by a few different factors. Fading is how the signal weakens with the distance of the
received power by the inverse square law. Shadowing is where there is no direct line of sight path
between the receiver and the transmitter. Diffraction occurs off of sharp edges in a room. Scattering
off of objects in a room.
Figure 6: Example desired input where the filled circles represent the beacons with the three highest
power levels and the unknown location is assumed to be somewhere between the three.
Figure 7: Example undesired input where the three highest power levels are scattered to the outskirts of
the grid which represents a much larger area where the unknown location could be. Furthermore this
input data does not make sense physically because the node will always be closer to three adjacent
beacons surrounding it than a beacon located on the other side of the grid.
Because for any given three highest power values the location of the unknown coordinate must be
somewhere in the area created by the implied triangle, a larger area indicates a larger possible error. If
beacons on both sides of the grid exhibit highest power levels, this indicates that there is an
inconsistency with the input RSSI values to the program because the node is always physically closest to
the nearest three beacons that are around it as illustrated in figure 5 (where the node is assumed to be
somewhere in the area between beacons 1, 2, and 5).
Program Example Calculations:
Figure 8: Sample figure generated by the program where the intersection of the three circles represents
the approximate area of the unknown point and the plotted asterisk marks the exact calculated
unknown coordinate. The plotted unknown coordinate is somewhat offset from the intersection of the
three signals. The plot text function is used to mark the unknown coordinate with an asterisk. This
slight shifting could be caused by the circle plotting or the text plot function so that the intersection is
not perfectly aligned with the point.
Figure 9: Received power inputs used to generate figure 8
Figure 10: Example of an invalid input data set where the trilateration calculation cannot be performed
and no unknown coordinate is plotted.
Figure 11: Input power values for figure 10 where NaN is printed to the command window for the XY
trilateration calculation results.
Source Code:
%Nikolas Simon
%trilat2d.m
function[ x, y, z ] = trilat2d(x1, x2, x3, y1, y2, y3, d1, d2,
d3, h)
%2-D trilateration function
% a constant of z is included to account for beacons and node not
being
% in the same 2d plane
%system of three pythagorean equations solved for x and y
A=x1^2+y1^2-d1^2;
B=x2^2+y2^2-d2^2;
C=x3^2+y3^2-d3^2;
xnum=A*(y3-y2)+B*(y1-y3)+C*(y2-y1);
xdem=2*(x1*(y3-y2)+x2*(y1-y3)+x3*(y2-y1));
ynum=A*(x3-x2)+B*(x1-x3)+C*(x2-x1);
ydem=2*(y1*(x3-x2)+y2*(x1-x3)+y3*(x2-x1));
x=xnum/xdem;
y=ynum/ydem;
z=h;
%Nikolas Simon
%sort_pr.m
%sorting function where the nineinput power levels are accepted
as inputs
%and Pa Pb Pc represent the three highest power levels. Ba Bb Bc
represent
%the three locations in the structure associated with the three
highest
%power levels
function [Pa Ba Pb Bb Pc
Bc]=sort_pr(Pr1,Pr2,Pr3,Pr4,Pr5,Pr6,Pr7,Pr8,Pr9)
%structure containing recieved power input values
beacon.p1=Pr1;
beacon.p2=Pr2;
beacon.p3=Pr3;
beacon.p4=Pr4;
beacon.p5=Pr5;
beacon.p6=Pr6;
beacon.p7=Pr7;
beacon.p8=Pr8;
beacon.p9=Pr9;
M=[beacon.p1 beacon.p2 beacon.p3 beacon.p4 beacon.p5 beacon.p6
beacon.p7...
beacon.p8 beacon.p9];
sortedValues = sort(M(:)); %sort values
maxValues = sortedValues(end-2:end); %find the 3 largest values
Pa=maxValues(3);
Pb=maxValues(2);
Pc=maxValues(1);
%series of switch case statements to determine the power level's
original
%location in the grid
switch Pa
case beacon.p1
Ba=1;
case beacon.p2
Ba=2;
case beacon.p3
Ba=3;
case beacon.p4
Ba=4;
case beacon.p5
Ba=5;
case beacon.p6
Ba=6;
case beacon.p7
Ba=7;
case beacon.p8
Ba=8;
case beacon.p9
Ba=9;
end
switch Pb
case beacon.p1
Bb=1;
case beacon.p2
Bb=2;
case beacon.p3
Bb=3;
case beacon.p4
Bb=4;
case beacon.p5
Bb=5;
case beacon.p6
Bb=6;
case beacon.p7
Bb=7;
case beacon.p8
Bb=8;
case beacon.p9
Bb=9;
end
switch Pc
case beacon.p1
Bc=1;
case beacon.p2
Bc=2;
case beacon.p3
Bc=3;
case beacon.p4
Bc=4;
case beacon.p5
Bc=5;
case beacon.p6
Bc=6;
case beacon.p7
Bc=7;
case beacon.p8
Bc=8;
case beacon.p9
Bc=9;
end
end
%Nikolas Simon
%power_to_d_friis.m
%friis distance equation implemented for each reference of the
three
%reference beacons
%function to calculate the radii to the unknown coordinate from
the
function[d1 d2 d3] =
power_to_d_friis(Pa,Pb,Pc,wavelength,gain,transmit_p)
%convert to miliwatts
pr1=(10.^(Pa/10));
pr2=(10.^(Pb/10));
pr3=(10.^(Pc/10));
pt=(10.^(transmit_p/10));
d1=wavelength/(4*pi*sqrt((pr1/pt)/(gain*gain)));
d2=wavelength/(4*pi*sqrt((pr2/pt)/(gain*gain)));
d3=wavelength/(4*pi*sqrt((pr3/pt)/(gain*gain)));
end
%Nikolas Simon
%distance_confirm.m
%function to calculate distance based on signal decay exponent
dependence
function[Ed1 Ed2 Ed3] =
distance_confirm(Pa,Pb,Pc,ref_recieved_pwr)
%1m refrence distance
d0=1;
%expected signal decay exponent for line of sight
n=1.7;
%taylor series calculation for each reference distance
k1=(log(10)*(ref_recieved_pwr-Pa))/(10*n);
k2=(log(10)*(ref_recieved_pwr-Pb))/(10*n);
k3=(log(10)*(ref_recieved_pwr-Pc))/(10*n);
Ed1=d0*(1+((k1)/(1))+((k1^2)/(factorial(2)))+((k1^3)/(factorial(3
)))+...
((k1^4)/(factorial(4)))+((k1^5)/(factorial(5))));
Ed2=d0*(1+((k2)/(1))+((k2^2)/(factorial(2)))+((k2^3)/(factorial(3
)))+...
((k2^4)/(factorial(4)))+((k2^5)/(factorial(5))));
Ed3=d0*(1+((k3)/(1))+((k3^2)/(factorial(2)))+((k3^3)/(factorial(3
)))+...
((k3^4)/(factorial(4)))+((k3^5)/(factorial(5))));
end
%Nikolas Simon
%power_to_xy.m
%point to point mapping functionto establish the reference grid
function [x1 y1 x2 y2 x3 y3]=power_to_xy(Ba,Bb,Bc)
%assumed layout mapping to cartesian with 7 as (1,1) in a 3x3
grid
%1_2_3
%4_5_6
%7_8_9
%scaling set to 1
scalePa=1;
scalePb=1;
scalePc=1;
%depending on the location inputs, the switch statements will
determine the
%cartiesian coordinates
switch Ba
case 1
x1=1*scalePa;
y1=3*scalePa;
case 2
x1=2*scalePa;
y1=3*scalePa;
case 3
x1=3*scalePa;
y1=3*scalePa;
case 4
x1=1*scalePa;
y1=2*scalePa;
case 5
x1=2*scalePa;
y1=2*scalePa;
case 6
x1=3*scalePa;
y1=2*scalePa;
case 7
x1=1*scalePa;
y1=1*scalePa;
case 8
x1=2*scalePa;
y1=1*scalePa;
case 9
x1=3*scalePa;
y1=1*scalePa;
end
switch Bb
case 1
x2=1*scalePb;
y2=3*scalePb;
case 2
x2=2*scalePb;
y2=3*scalePb;
case 3
x2=3*scalePb;
y2=3*scalePb;
case 4
x2=1*scalePb;
y2=2*scalePb;
case 5
x2=2*scalePb;
y2=2*scalePb;
case 6
x2=3*scalePb;
y2=2*scalePb;
case 7
x2=1*scalePb;
y2=1*scalePb;
case 8
x2=2*scalePb;
y2=1*scalePb;
case 9
x2=3*scalePb;
y2=1*scalePb;
end
switch Bc
case 1
x3=1*scalePc;
y3=3*scalePc;
case 2
x3=2*scalePc;
y3=3*scalePc;
case 3
x3=3*scalePc;
y3=3*scalePc;
case 4
x3=1*scalePc;
y3=2*scalePc;
case 5
x3=2*scalePc;
y3=2*scalePc;
case 6
x3=3*scalePc;
y3=2*scalePc;
case 7
x3=1*scalePc;
y3=1*scalePc;
case 8
x3=2*scalePc;
y3=1*scalePc;
case 9
x3=3*scalePc;
y3=1*scalePc;
end
end
%Nikolas Simon
%circle.m
%plotting function to show the trilateration calculation
graphically
%accepts the three reference xy values and thier respective
distances, the
%input variables a,b,c represent which subplot is being plotted,
theLabel
%is an input string for each subplot title, ux and uy are the
calculated
%coordinates of the unknown node indicated graphically by an
asterisk
function circle(x1,y1,r1,x2,y2,r2,x3,y3,r3,a,b,c,theLabel,ux,uy)
hold on
subplot(a,b,c);
th = 0:pi/50:2*pi;
%circle 1
xunit1 = r1 * cos(th) + x1;
yunit1 = r1 * sin(th) + y1;
%circle 2
xunit2 = r2 * cos(th) + x2;
yunit2 = r2 * sin(th) + y2;
%circle 3
xunit3 = r3 * cos(th) + x3;
yunit3 = r3 * sin(th) + y3;
plot(xunit1, yunit1,xunit2, yunit2,xunit3, yunit3);
grid on
title(num2str(theLabel));
text(ux,uy,'*');
hold off
%Nikolas Simon
%testscript.m
%test fixture for the calculation functions
%display two different figures using the same circle plotting
function, the
%trilateration results using the friis equation for distance and
the signal
%path exponent equation for distance
%define constant values
h=5;%set room height to 5m
wavelength=0.3279;%meters
transmit_p=10;%dBm
gain=9.6899;%antenna gain dB
ref_recieved_pwr=1;%dBm
%user entered recieved power levels
% sample values used in documentation -11,-14,-13,-20,-4,-1,-9,-
3,-9
p1 = input('Enter Power Value 1: ');
p2 = input('Enter Power Value 2: ');
p3 = input('Enter Power Value 3: ');
p4 = input('Enter Power Value 4: ');
p5 = input('Enter Power Value 5: ');
p6 = input('Enter Power Value 6: ');
p7 = input('Enter Power Value 7: ');
p8 = input('Enter Power Value 8: ');
p9 = input('Enter Power Value 9: ');
%call to the sorting function
[Pa Ba Pb Bb Pc Bc]=sort_pr(p1,p2,p3,p4,p5,p6,p7,p8,p9);
%call to the mapping function
[x1 y1 x2 y2 x3 y3]=power_to_xy(Ba,Bb,Bc);
%friis distance calculation
[d1 d2 d3] =
power_to_d_friis(Pa,Pb,Pc,wavelength,gain,transmit_p);
%signal decay exponent distance calculation
[Ed1 Ed2 Ed3] = distance_confirm(Pa,Pb,Pc,ref_recieved_pwr);
%calls to the trilateration function using
[ x_1, y_1, z_1 ] = trilat2d(x1, x2, x3, y1, y2, y3, d1, d2, d3,
h);
[ x_2, y_2, z_2 ] = trilat2d(x1, x2, x3, y1, y2, y3, Ed1, Ed2,
Ed3, h);
%plot the xy point on the graph
circle(x1,y1,d1,x2,y2,d2,x3,y3,d3,1,2,1,'Trilateration Using
Friis Distance',x_1,y_1);
circle(x1,y1,Ed1,x2,y2,Ed2,x3,y3,Ed3,1,2,2,'Trilateration Using
Signal Path Exponent Distance',x_2,y_2);
%display relevant distance and xy values to the command window
disp('x y z coordinates Friis')
disp(x_1);
disp(y_1);
disp(z_1);
disp('x y z coordinates signal decay exponent')
disp(x_2);
disp(y_2);
disp(z_2);
disp('Friis d values')
disp(d1);
disp(d2);
disp(d3);
disp('path exponent d values')
disp(Ed1);
disp(Ed2);
disp(Ed3);
Works Referenced:
http://cdn.intechweb.org/pdfs/13525.pdf
http://www.es.ewi.tudelft.nl/msc-theses/2013-Kocsi.pdf
https://books.google.com/books?id=mdQlBAAAQBAJ&pg=PA404&lpg=PA404&dq=signal+decay+expone
nt+rssi&source=bl&ots=7aKCjETv38&sig=ex_vF6Ye1jf31wJ6waNMQRO7ZKs&hl=en&sa=X&ved=0ahUKE
wiO5sWgs-HKAhXFdT4KHesYBSkQ6AEILzAC#v=onepage&q&f=false
http://www.ijser.org/researchpaper%5CWi-Fi-Indoor-Positioning-System-Based-on-RSSI-
Measurements.pdf
http://www.antenna-theory.com/basics/aperture.php
http://www.tscm.com/pwr-dens.pdf
http://cial.csie.ncku.edu.tw/publication/pdf/conference_papers/A%20RSSI-
based%20Algorithm%20for%20Indoor%20Localization%20Using%20ZigBee%20in%20Wireless%20Senso
r%20Network.pdf

More Related Content

What's hot

Frequency Control & AGC.ppt
Frequency Control & AGC.pptFrequency Control & AGC.ppt
Frequency Control & AGC.pptSurajit Banerjee
 
Electrical analogous of mechanical translational system
Electrical analogous of mechanical translational systemElectrical analogous of mechanical translational system
Electrical analogous of mechanical translational systemKALPANA K
 
Chapter 10 balanced faults analysis
Chapter 10 balanced faults analysisChapter 10 balanced faults analysis
Chapter 10 balanced faults analysisEngr umar
 
TRANSFER FUNCTION (4).pptx
TRANSFER FUNCTION (4).pptxTRANSFER FUNCTION (4).pptx
TRANSFER FUNCTION (4).pptxankit317032
 
digital control Chapter1 slide
digital control Chapter1 slidedigital control Chapter1 slide
digital control Chapter1 slideasyrafjpk
 
State space analysis, eign values and eign vectors
State space analysis, eign values and eign vectorsState space analysis, eign values and eign vectors
State space analysis, eign values and eign vectorsShilpa Shukla
 
Automatic car parking barrier system using plc presentation
Automatic car parking barrier system using plc presentationAutomatic car parking barrier system using plc presentation
Automatic car parking barrier system using plc presentationDaniyalMeesum
 
Lecture 2 transfer-function
Lecture 2 transfer-functionLecture 2 transfer-function
Lecture 2 transfer-functionSaifullah Memon
 
Pe 3032 wk 1 introduction to control system march 04e
Pe 3032 wk 1 introduction to control system  march 04ePe 3032 wk 1 introduction to control system  march 04e
Pe 3032 wk 1 introduction to control system march 04eCharlton Inao
 
Electric traction
Electric tractionElectric traction
Electric tractionDipak Meher
 
frequency re use nb
frequency re use nbfrequency re use nb
frequency re use nbAJAL A J
 
Block diagram reduction techniques
Block diagram reduction techniquesBlock diagram reduction techniques
Block diagram reduction techniquesSatheeshCS2
 
Double Line To Ground Fault Analysis
Double Line To Ground Fault AnalysisDouble Line To Ground Fault Analysis
Double Line To Ground Fault AnalysisHarsh Soni
 
Modern Control - Lec07 - State Space Modeling of LTI Systems
Modern Control - Lec07 - State Space Modeling of LTI SystemsModern Control - Lec07 - State Space Modeling of LTI Systems
Modern Control - Lec07 - State Space Modeling of LTI SystemsAmr E. Mohamed
 

What's hot (20)

Frequency Control & AGC.ppt
Frequency Control & AGC.pptFrequency Control & AGC.ppt
Frequency Control & AGC.ppt
 
3.magnetically coupled circuit
3.magnetically coupled circuit3.magnetically coupled circuit
3.magnetically coupled circuit
 
Signal flow graph
Signal flow graphSignal flow graph
Signal flow graph
 
Electrical analogous of mechanical translational system
Electrical analogous of mechanical translational systemElectrical analogous of mechanical translational system
Electrical analogous of mechanical translational system
 
Bresenham algorithm
Bresenham algorithmBresenham algorithm
Bresenham algorithm
 
Chapter 10 balanced faults analysis
Chapter 10 balanced faults analysisChapter 10 balanced faults analysis
Chapter 10 balanced faults analysis
 
TRANSFER FUNCTION (4).pptx
TRANSFER FUNCTION (4).pptxTRANSFER FUNCTION (4).pptx
TRANSFER FUNCTION (4).pptx
 
Control chap5
Control chap5Control chap5
Control chap5
 
digital control Chapter1 slide
digital control Chapter1 slidedigital control Chapter1 slide
digital control Chapter1 slide
 
State space analysis, eign values and eign vectors
State space analysis, eign values and eign vectorsState space analysis, eign values and eign vectors
State space analysis, eign values and eign vectors
 
Automatic car parking barrier system using plc presentation
Automatic car parking barrier system using plc presentationAutomatic car parking barrier system using plc presentation
Automatic car parking barrier system using plc presentation
 
Lecture 2 transfer-function
Lecture 2 transfer-functionLecture 2 transfer-function
Lecture 2 transfer-function
 
Pe 3032 wk 1 introduction to control system march 04e
Pe 3032 wk 1 introduction to control system  march 04ePe 3032 wk 1 introduction to control system  march 04e
Pe 3032 wk 1 introduction to control system march 04e
 
Electric traction
Electric tractionElectric traction
Electric traction
 
frequency re use nb
frequency re use nbfrequency re use nb
frequency re use nb
 
Block diagram reduction techniques
Block diagram reduction techniquesBlock diagram reduction techniques
Block diagram reduction techniques
 
Double Line To Ground Fault Analysis
Double Line To Ground Fault AnalysisDouble Line To Ground Fault Analysis
Double Line To Ground Fault Analysis
 
Modern Control - Lec07 - State Space Modeling of LTI Systems
Modern Control - Lec07 - State Space Modeling of LTI SystemsModern Control - Lec07 - State Space Modeling of LTI Systems
Modern Control - Lec07 - State Space Modeling of LTI Systems
 
Control system
Control systemControl system
Control system
 
Pcs ch1
Pcs ch1Pcs ch1
Pcs ch1
 

Similar to Trilateration Calculation Program for Location Tracking System

Ill-posedness formulation of the emission source localization in the radio- d...
Ill-posedness formulation of the emission source localization in the radio- d...Ill-posedness formulation of the emission source localization in the radio- d...
Ill-posedness formulation of the emission source localization in the radio- d...Ahmed Ammar Rebai PhD
 
Project 3 “Satellite Link Budgets and PE”
Project 3 “Satellite Link Budgets and PE”Project 3 “Satellite Link Budgets and PE”
Project 3 “Satellite Link Budgets and PE”Danish Bangash
 
Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...
Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...
Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...IJMER
 
Sensor Localization presentation1&2
Sensor Localization  presentation1&2Sensor Localization  presentation1&2
Sensor Localization presentation1&2gamalsallam1989
 
MULTI-ANTENNA LOCALIZATION METHOD
MULTI-ANTENNA LOCALIZATION METHODMULTI-ANTENNA LOCALIZATION METHOD
MULTI-ANTENNA LOCALIZATION METHODijwmn
 
Distributed_Array_Algos.pptx
Distributed_Array_Algos.pptxDistributed_Array_Algos.pptx
Distributed_Array_Algos.pptxf20170649g
 
Summer 2012 Project Report
Summer 2012 Project ReportSummer 2012 Project Report
Summer 2012 Project ReportLalit Pradhan
 
Adaptive analog beamforming
Adaptive analog beamformingAdaptive analog beamforming
Adaptive analog beamformingKhalid Hussain
 
Digital Beamforming for Simultaneous Power and Information Transmission in Wi...
Digital Beamforming for Simultaneous Power and Information Transmission in Wi...Digital Beamforming for Simultaneous Power and Information Transmission in Wi...
Digital Beamforming for Simultaneous Power and Information Transmission in Wi...idescitation
 
5 13meeting佑任
5 13meeting佑任5 13meeting佑任
5 13meeting佑任guest0bd446
 
Limitation of Maasive MIMO in Antenna Correlation
Limitation of Maasive MIMO in Antenna CorrelationLimitation of Maasive MIMO in Antenna Correlation
Limitation of Maasive MIMO in Antenna CorrelationVARUN KUMAR
 
Performance analysis of music and esprit doa estimation algorithms for adapti...
Performance analysis of music and esprit doa estimation algorithms for adapti...Performance analysis of music and esprit doa estimation algorithms for adapti...
Performance analysis of music and esprit doa estimation algorithms for adapti...marwaeng
 
3D routing algorithm for sensor network in e-health
3D routing algorithm for sensor network in e-health3D routing algorithm for sensor network in e-health
3D routing algorithm for sensor network in e-healthVakhtang Mosidze
 
Chapter 5(Cellular Concepts)
Chapter 5(Cellular Concepts)Chapter 5(Cellular Concepts)
Chapter 5(Cellular Concepts)Nusrat Sharmin
 
Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...
Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...
Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...TELKOMNIKA JOURNAL
 

Similar to Trilateration Calculation Program for Location Tracking System (20)

Ill-posedness formulation of the emission source localization in the radio- d...
Ill-posedness formulation of the emission source localization in the radio- d...Ill-posedness formulation of the emission source localization in the radio- d...
Ill-posedness formulation of the emission source localization in the radio- d...
 
Project 3 “Satellite Link Budgets and PE”
Project 3 “Satellite Link Budgets and PE”Project 3 “Satellite Link Budgets and PE”
Project 3 “Satellite Link Budgets and PE”
 
Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...
Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...
Three Element Beam forming Algorithm with Reduced Interference Effect in Sign...
 
Sensor Localization presentation1&2
Sensor Localization  presentation1&2Sensor Localization  presentation1&2
Sensor Localization presentation1&2
 
MULTI-ANTENNA LOCALIZATION METHOD
MULTI-ANTENNA LOCALIZATION METHODMULTI-ANTENNA LOCALIZATION METHOD
MULTI-ANTENNA LOCALIZATION METHOD
 
Distributed_Array_Algos.pptx
Distributed_Array_Algos.pptxDistributed_Array_Algos.pptx
Distributed_Array_Algos.pptx
 
2015LISAT_pathloss1
2015LISAT_pathloss12015LISAT_pathloss1
2015LISAT_pathloss1
 
Summer 2012 Project Report
Summer 2012 Project ReportSummer 2012 Project Report
Summer 2012 Project Report
 
Adaptive analog beamforming
Adaptive analog beamformingAdaptive analog beamforming
Adaptive analog beamforming
 
Digital Beamforming for Simultaneous Power and Information Transmission in Wi...
Digital Beamforming for Simultaneous Power and Information Transmission in Wi...Digital Beamforming for Simultaneous Power and Information Transmission in Wi...
Digital Beamforming for Simultaneous Power and Information Transmission in Wi...
 
Masters Report 1
Masters Report 1Masters Report 1
Masters Report 1
 
5 13meeting佑任
5 13meeting佑任5 13meeting佑任
5 13meeting佑任
 
Limitation of Maasive MIMO in Antenna Correlation
Limitation of Maasive MIMO in Antenna CorrelationLimitation of Maasive MIMO in Antenna Correlation
Limitation of Maasive MIMO in Antenna Correlation
 
5 13meeting2
5 13meeting25 13meeting2
5 13meeting2
 
Performance analysis of music and esprit doa estimation algorithms for adapti...
Performance analysis of music and esprit doa estimation algorithms for adapti...Performance analysis of music and esprit doa estimation algorithms for adapti...
Performance analysis of music and esprit doa estimation algorithms for adapti...
 
3D routing algorithm for sensor network in e-health
3D routing algorithm for sensor network in e-health3D routing algorithm for sensor network in e-health
3D routing algorithm for sensor network in e-health
 
Poster
PosterPoster
Poster
 
Chapter 5(Cellular Concepts)
Chapter 5(Cellular Concepts)Chapter 5(Cellular Concepts)
Chapter 5(Cellular Concepts)
 
Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...
Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...
Performance Evaluation of DV-HOP and Amorphous Algorithms based on Localizati...
 
Path loss prediction
Path loss predictionPath loss prediction
Path loss prediction
 

Recently uploaded

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Recently uploaded (20)

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 

Trilateration Calculation Program for Location Tracking System

  • 1. MSOE MEMO To: [Dr. Tritt] From: Simon, Nikolas A. Date: February 16, 2016 Re: [Project (trilat2d.m,sort_pr.m,power_to_d_friis.m,distance_confirm.m,power_to_xy.m,circle.m,testscript.m) ] Program Description: This program serves at the main calculation tool for a more complex location tracking system. This location tracking system seeks to determine the location of a node based on received power levels from a fixed grid of beacons. The location tracking system is implemented such that the beacons are ceiling mounted and the node can move in XY directions on the floor below. These beacons are strategically placed in a 3 by 3 grid and are tagged such that it is clear from the program input which power level is which. Each beacon broadcasts message payloads containing beacon number and a power level in units of dBm. The node detects the associated RSSI (receives signal strength indicator) values of these beacons which means each beacon in the grid has an identifying label and an associated received power level from the perspective of the node. The power values are stored in a list from 1 to 9 where they are then sorted into the three highest power levels. Expected RSSI received input power levels are between 0 and -120 dBm. The known level of transmit power Pt for all beacons is in the grid is approximately +10dbm. The known gains of the transmit and receive antennas on the beacons and nodes are 9.6899 dB. A method called trilateration is used to calculate the unknown node coordinate. Trilateration determines an unknown location from multiple reference locations. The distances relative to these reference locations are used to estimate the coordinate of the unknown location. At least three reference locations must exist for trilateration to be implemented. If three reference locations are considered, the origin of each reference location can be considered the center of a sphere where the unknown location is the intersection of all three spheres. For the trilateration calculation to work correctly, at least three beacon received power levels must be known to determine the unknown location of the node in 2 dimensions. Because the node is constrained to XY coordinates and can not move freely in the Z direction, a constant is introduced to account for the difference in distance between the ceiling mounted beacons and the ground node in the physical implementation of the program. Equations of Interest: Wavelength: ߣ = ܿ ݂ Equation 1: Wavelength relates the speed of light to a desired frequency ‫ܦ‬ଶ = ‫ܣ‬ଶ + ‫ܤ‬ଶ + ‫ܥ‬ଶ Equation 2: 3d Pythagorean Theorem considers the Z direction
  • 2. ܲ௥ ܲ௧ = ‫ܩ‬௧‫ܩ‬௥ ൬ ߣ 4ߨܴ ൰ ଶ Equation 3: Friis Equation relating received power, transmitted power, transmit/receive antenna gains, wavelength, and range in an inverse square relationship of the three highest power levels When solved for distance: → ݀ = ߣ 4ߨ ඨ ܲ௥ ܲ௧ ‫ܩ‬௥‫ܩ‬௧ ܲ௅ = ܲ௧ ܲ௥ Equation 4: Linear path loss ratio which related transmitted power to received power. Path loss can be determined by taking the ratio of transmitted power to received power. Depending on changes to the orientation of the test environment, this value will change. ܲ௥ = ܲ௧ + 20 log ൬ ߣ 4ߨ ൰ + 10݈݊‫݃݋‬ ൬ 1 ݀ ൰ Equation 5: Equation for received power using the signal decay exponent which represents environmental characterization ݊ = ܲ௥ሺௗ଴ሻ − ܲ௥ሺௗሻ 10 logଵ଴ ൬ ݀ ݀଴ ൰ Equation 6: Environmental calibration equation for the signal decay exponent where ܲ௥ሺௗ଴ሻ is a reference received power level at 1 meter away from the source and ܲ௥ሺௗሻ is the received power level at a distance d away from the source Solving for d: → 10݊ሾlogଵ଴ሺ݀ሻ − logଵ଴ሺ݀଴ሻሿ = ܲ௥ሺௗ଴ሻ − ܲ௥ሺௗሻ → logଵ଴ሺ݀ሻ = ܲ௥ሺௗ଴ሻ − ܲ௥ሺௗሻ + 10݈݊‫݃݋‬ଵ଴ሺ݀଴ሻ 10݊ → ݀ = 10 ൤ ௉ೝሺ೏బሻି௉ೝሺ೏ሻାଵ଴௡௟௢௚భబሺௗబሻ ଵ଴௡ ൨ However exponential calculations like this can be computationally intensive and cause lag time in a program implementation. To reduce computation time, the distance is calculated with a series expansion to the needed accuracy. ݀ = ݀଴ ቂ1 + ௞ ଵ! + ௞ ଶ! + ௞ ଷ! + ௞ ସ! + ௞ ହ! + ⋯ ቃ , ݇ = ୪୬ሺଵ଴ሻሾ௉ೝሺ೏బሻି௉ೝሺ೏ሻሿ ଵ଴௡
  • 3. Received power can be determined with the environmental calibration equation which is dependent on the signal decay exponent and with the Friis equation which is dependent on knowing the gains of the transmit and receive antennas. Being able to calculate received power in two different ways allows for a method of error checking because gain is not dependent on the signal decay exponent, it is a physical characteristic of the antenna: → ‫ܩ‬௥ = 4ߨ‫ܣ‬௘ ߣଶ Receiver gain equation where Ae represents effective aperture (area covered by the transmitter). → ‫ܣ‬௘ = ܲ௧ ܲௗ The effective aperture is a function of power density Pd. → ܲௗ ൤ ܹ ݉ଶ൨ = ܲ௧‫ܩ‬௧ 4ߨ݀ Power density is a function of transmit gain. When comparing the Friis distance values and the signal decay exponent distance values, they are no more than 1 meter apart from each other for any given calculation. Any more than this would indicate a calculation error. Simple 2d Trilateration Equations: ݀ଵ ଶ = ሺ‫ݔ‬ଵ − ‫ݔ‬ሻଶ + ሺ‫ݕ‬ଵ − ‫ݕ‬ሻଶ ݀ଶ ଶ = ሺ‫ݔ‬ଶ − ‫ݔ‬ሻଶ + ሺ‫ݕ‬ଶ − ‫ݕ‬ሻଶ ݀ଷ ଶ = ሺ‫ݔ‬ଷ − ‫ݔ‬ሻଶ + ሺ‫ݕ‬ଷ − ‫ݕ‬ሻଶ Equation Set 7: ݀ଵ,ଶ,ଷ represents the distances between the reference beacons and the target unknown node solved for with the Pythagorean Theorem. ‫ݔ‬ = ‫ܻܣ‬ଷଶ + ‫ܻܤ‬ଵଷ + ‫ܻܥ‬ଶଵ 2ሺ‫ݔ‬ଵ‫ݕ‬ଷଶ + ‫ݔ‬ଶ‫ݕ‬ଵଷ + ‫ݔ‬ଷ‫ݕ‬ଶଵሻ ‫ݕ‬ = ‫ܺܣ‬ଷଶ + ‫ܺܤ‬ଵଷ + ‫ܺܥ‬ଶଵ 2ሺ‫ݕ‬ଵ‫ݔ‬ଷଶ + ‫ݕ‬ଶ‫ݔ‬ଵଷ + ‫ݕ‬ଷ‫ݔ‬ଶଵሻ Where: ‫ܣ‬ = ‫ݔ‬ଵ ଶ + ‫ݕ‬ଵ ଶ − ݀ଵ ଶ ‫ܤ‬ = ‫ݔ‬ଶ ଶ + ‫ݕ‬ଶ ଶ − ݀ଶ ଶ ‫ܥ‬ = ‫ݔ‬ଷ ଶ + ‫ݕ‬ଷ ଶ − ݀ଷ ଶ Equation Set 8: The system of Pythagorean equations is used to solve for the unknown x and y coordinates which refer to ܶሺ‫,ݔ‬ ‫ݕ‬ሻ in figure 1. The notation ܺ௔௕ and ܻ௔௕ means ሺ‫ݔ‬௔ − ‫ݔ‬௕ሻandሺ‫ݕ‬௔ − ‫ݕ‬௕ሻ.
  • 4. Figure 1: Diagram of trilateration using three known reference points to determine an unknown coordinate at the intersection of all three radii. Rଵ,ଶ,ଷ represent the coordinates of the reference locations. When adjusting for the fact that the node and beacons are not in the same plane, a Z component must be introduced into the trilateration equations so the 3d form of the Pythagorean Theorem must be used for in the system of Pythagorean equations. The z value is always a constant in the implementation, there is no z direction so it is assumes that the mobile node cannot move freely in the z direction: ݀ଵ ଶ = ሺ‫ݔ‬ଵ − ‫ݔ‬ሻଶ + ሺ‫ݕ‬ଵ − ‫ݕ‬ሻଶ + ሺ‫ݖ‬ሻଶ ݀ଶ ଶ = ሺ‫ݔ‬ଶ − ‫ݔ‬ሻଶ + ሺ‫ݕ‬ଶ − ‫ݕ‬ሻଶ + ሺ‫ݖ‬ሻଶ ݀ଷ ଶ = ሺ‫ݔ‬ଷ − ‫ݔ‬ሻଶ + ሺ‫ݕ‬ଷ − ‫ݕ‬ሻଶ + ሺ‫ݖ‬ሻଶ There is no dependence in the z direction therefore the equation for Z reduces to Z=Z. Program Inputs: Received beacon power levels 1 to 9 Program Outputs: X Y coordinates of unknown location, linear path loss, d error rate, power density, effective aperture
  • 5. Intermediate Values: PA: highest received power level PB: second highest received power level PC: third highest received power level D1: transmit radius of beacon with the highest received power level D2: transmit radius of beacon with the second highest received power level D3: transmit radius of beacon with the third highest received power level X1,Y1 : grid coordinates of the beacon with the highest received power level X2,Y2 : grid coordinates of the beacon with the second highest received power level X3,Y3 : grid coordinates of the beacon with the third highest received power level Constants: λ: 0.3279m wavelength equal to ௖ ௙ where c is the speed of light and f is the desired center frequency of 915MHz Gt: 9.6899dB, transmit antenna gain Gr: 9.6899dB , receive antenna gain Pt: ≈+10dbM , transmit power Prd0: 1 dBm, reference received power level at 1m H: vertical distance from node to ceiling mounted beacons Discussion of Algorithm: The user enters a list of 9 received power values in units of dBm. From 1 to 9 each number corresponds with a fixed position in the 3x3 grid of beacons. The entered values are then sorted into the highest three values, making sure to keep track of each power value’s specific location number. The three highest power levels are then entered into the power distance relationship described by the Friis equation. The three highest power levels must also determine the three individual XY coordinates belonging to the three highest received power signals. These three results must then be weighted by power strength to properly align the unknown node coordinate within the triangle of possible area between the three highest received beacon power levels.
  • 6. Figure 2: Illustration of possible position within three selected beacon locations. Based on highest, middle, and lowest power level a weighting is applied which places the coordinate closer to the beacons which output the highest power. This weighting affects the distance component of the calculations. The three highest power levels must be processed and converted to three distinct XY coordinates representing each beacon location. A point to point mapping of the beacon layout is predefined and Cartesian coordinates are assigned to each beacon. Figure 3: Mapping to Cartesian coordinates In the original brainstorming of the algorithm development matrices were considered for data processing and grid mapping. Storing values in matrices serves to further complicate the design unnecessarily and the use of matrix calculations would increase calculation time which may affect response time when the program is deployed. Program Functions: 1) Sort Received Powers(sort_pr.m) Inputs: 9 Pr values in units of dBm Saves inputs to a structure and sorts out the three highest values and their associated beacon number Outputs: 3 greatest Pr values in the possible range of between 0 and -120 dBm, and their associated beacon number H LM
  • 7. 2) Coordinate Mapping(power_to_xy.m) Inputs: beacon number associated with 3 highest Pr values Maps beacon number to Cartesian in the pattern described in Figure 3. Outputs: x y coordinates for each of the three beacons 3) Power to distance conversion(power_to_d_friis.m) Inputs: three highest power levels Implementation of Equation 3 Outputs: three distances representing the radius of each reference point for trilateration 4) Error Checking(distance_confirm.m) Inputs: 3 highest received powers, reference received power The second method for distance calculation to compare with the results from the first distance calculation (implementation of the series form of Equation 5). Outputs: 3 distances representing the radius of each reference point for trilateration 5) Trilateration(trilat2d.m) Inputs: x y coordinates of the three reference beacons, distances of each reference point Implementation of trilateration equations Outputs: unknown x y coordinate 6) Calculation Plotting(circle.m) Inputs: x y coordinates and d for each reference location, the unknown coordinate, plot formatting Plots reference points and the circle representing their individual distances represented in Figure 1 as well as the unknown coordinate with the plot text function Outputs: figure displaying unknown coordinate graphically 7) Test Fixture(testscript.m) Inputs: User entered received power values Calls all of the previously described functions and prompts the user for input data in the command window. Outputs: Figure displaying calculation results graphically
  • 8. Figure 4: Concept flow diagram of program operation Error Detection: The radii represented by the three distances must also intersect for all three beacon locations. This can be tested geometrically by comparing distances based on the origin of each beacon where overlap indicates a successful basis for trilateration. Figure 5: Illustration of all three radii not intersecting indicating that a valid trilateration calculation cannot be performed Due to the fact that received power can be calculated in two different ways (by knowing the gain, and by knowing the signal decay exponent), program inputs can be checked for validity. The system equipment uses 915MHz patch antennas with a gain of 9.6899 dB and the expected path loss exponent for line of sight is approximately 1.7 .
  • 9. RSSI is influenced by a few different factors. Fading is how the signal weakens with the distance of the received power by the inverse square law. Shadowing is where there is no direct line of sight path between the receiver and the transmitter. Diffraction occurs off of sharp edges in a room. Scattering off of objects in a room. Figure 6: Example desired input where the filled circles represent the beacons with the three highest power levels and the unknown location is assumed to be somewhere between the three. Figure 7: Example undesired input where the three highest power levels are scattered to the outskirts of the grid which represents a much larger area where the unknown location could be. Furthermore this input data does not make sense physically because the node will always be closer to three adjacent beacons surrounding it than a beacon located on the other side of the grid.
  • 10. Because for any given three highest power values the location of the unknown coordinate must be somewhere in the area created by the implied triangle, a larger area indicates a larger possible error. If beacons on both sides of the grid exhibit highest power levels, this indicates that there is an inconsistency with the input RSSI values to the program because the node is always physically closest to the nearest three beacons that are around it as illustrated in figure 5 (where the node is assumed to be somewhere in the area between beacons 1, 2, and 5). Program Example Calculations: Figure 8: Sample figure generated by the program where the intersection of the three circles represents the approximate area of the unknown point and the plotted asterisk marks the exact calculated unknown coordinate. The plotted unknown coordinate is somewhat offset from the intersection of the three signals. The plot text function is used to mark the unknown coordinate with an asterisk. This slight shifting could be caused by the circle plotting or the text plot function so that the intersection is not perfectly aligned with the point. Figure 9: Received power inputs used to generate figure 8
  • 11. Figure 10: Example of an invalid input data set where the trilateration calculation cannot be performed and no unknown coordinate is plotted. Figure 11: Input power values for figure 10 where NaN is printed to the command window for the XY trilateration calculation results.
  • 12. Source Code: %Nikolas Simon %trilat2d.m function[ x, y, z ] = trilat2d(x1, x2, x3, y1, y2, y3, d1, d2, d3, h) %2-D trilateration function % a constant of z is included to account for beacons and node not being % in the same 2d plane %system of three pythagorean equations solved for x and y A=x1^2+y1^2-d1^2; B=x2^2+y2^2-d2^2; C=x3^2+y3^2-d3^2; xnum=A*(y3-y2)+B*(y1-y3)+C*(y2-y1); xdem=2*(x1*(y3-y2)+x2*(y1-y3)+x3*(y2-y1)); ynum=A*(x3-x2)+B*(x1-x3)+C*(x2-x1); ydem=2*(y1*(x3-x2)+y2*(x1-x3)+y3*(x2-x1)); x=xnum/xdem; y=ynum/ydem; z=h; %Nikolas Simon %sort_pr.m %sorting function where the nineinput power levels are accepted as inputs %and Pa Pb Pc represent the three highest power levels. Ba Bb Bc represent %the three locations in the structure associated with the three highest %power levels function [Pa Ba Pb Bb Pc Bc]=sort_pr(Pr1,Pr2,Pr3,Pr4,Pr5,Pr6,Pr7,Pr8,Pr9) %structure containing recieved power input values beacon.p1=Pr1; beacon.p2=Pr2; beacon.p3=Pr3; beacon.p4=Pr4;
  • 13. beacon.p5=Pr5; beacon.p6=Pr6; beacon.p7=Pr7; beacon.p8=Pr8; beacon.p9=Pr9; M=[beacon.p1 beacon.p2 beacon.p3 beacon.p4 beacon.p5 beacon.p6 beacon.p7... beacon.p8 beacon.p9]; sortedValues = sort(M(:)); %sort values maxValues = sortedValues(end-2:end); %find the 3 largest values Pa=maxValues(3); Pb=maxValues(2); Pc=maxValues(1); %series of switch case statements to determine the power level's original %location in the grid switch Pa case beacon.p1 Ba=1; case beacon.p2 Ba=2; case beacon.p3 Ba=3; case beacon.p4 Ba=4; case beacon.p5 Ba=5; case beacon.p6 Ba=6; case beacon.p7 Ba=7; case beacon.p8 Ba=8; case beacon.p9 Ba=9; end switch Pb case beacon.p1
  • 14. Bb=1; case beacon.p2 Bb=2; case beacon.p3 Bb=3; case beacon.p4 Bb=4; case beacon.p5 Bb=5; case beacon.p6 Bb=6; case beacon.p7 Bb=7; case beacon.p8 Bb=8; case beacon.p9 Bb=9; end switch Pc case beacon.p1 Bc=1; case beacon.p2 Bc=2; case beacon.p3 Bc=3; case beacon.p4 Bc=4; case beacon.p5 Bc=5; case beacon.p6 Bc=6; case beacon.p7 Bc=7; case beacon.p8 Bc=8; case beacon.p9 Bc=9; end end %Nikolas Simon
  • 15. %power_to_d_friis.m %friis distance equation implemented for each reference of the three %reference beacons %function to calculate the radii to the unknown coordinate from the function[d1 d2 d3] = power_to_d_friis(Pa,Pb,Pc,wavelength,gain,transmit_p) %convert to miliwatts pr1=(10.^(Pa/10)); pr2=(10.^(Pb/10)); pr3=(10.^(Pc/10)); pt=(10.^(transmit_p/10)); d1=wavelength/(4*pi*sqrt((pr1/pt)/(gain*gain))); d2=wavelength/(4*pi*sqrt((pr2/pt)/(gain*gain))); d3=wavelength/(4*pi*sqrt((pr3/pt)/(gain*gain))); end %Nikolas Simon %distance_confirm.m %function to calculate distance based on signal decay exponent dependence function[Ed1 Ed2 Ed3] = distance_confirm(Pa,Pb,Pc,ref_recieved_pwr) %1m refrence distance d0=1; %expected signal decay exponent for line of sight n=1.7; %taylor series calculation for each reference distance k1=(log(10)*(ref_recieved_pwr-Pa))/(10*n); k2=(log(10)*(ref_recieved_pwr-Pb))/(10*n); k3=(log(10)*(ref_recieved_pwr-Pc))/(10*n); Ed1=d0*(1+((k1)/(1))+((k1^2)/(factorial(2)))+((k1^3)/(factorial(3 )))+...
  • 16. ((k1^4)/(factorial(4)))+((k1^5)/(factorial(5)))); Ed2=d0*(1+((k2)/(1))+((k2^2)/(factorial(2)))+((k2^3)/(factorial(3 )))+... ((k2^4)/(factorial(4)))+((k2^5)/(factorial(5)))); Ed3=d0*(1+((k3)/(1))+((k3^2)/(factorial(2)))+((k3^3)/(factorial(3 )))+... ((k3^4)/(factorial(4)))+((k3^5)/(factorial(5)))); end %Nikolas Simon %power_to_xy.m %point to point mapping functionto establish the reference grid function [x1 y1 x2 y2 x3 y3]=power_to_xy(Ba,Bb,Bc) %assumed layout mapping to cartesian with 7 as (1,1) in a 3x3 grid %1_2_3 %4_5_6 %7_8_9 %scaling set to 1 scalePa=1; scalePb=1; scalePc=1; %depending on the location inputs, the switch statements will determine the %cartiesian coordinates switch Ba case 1 x1=1*scalePa; y1=3*scalePa; case 2 x1=2*scalePa; y1=3*scalePa; case 3 x1=3*scalePa; y1=3*scalePa; case 4 x1=1*scalePa; y1=2*scalePa;
  • 17. case 5 x1=2*scalePa; y1=2*scalePa; case 6 x1=3*scalePa; y1=2*scalePa; case 7 x1=1*scalePa; y1=1*scalePa; case 8 x1=2*scalePa; y1=1*scalePa; case 9 x1=3*scalePa; y1=1*scalePa; end switch Bb case 1 x2=1*scalePb; y2=3*scalePb; case 2 x2=2*scalePb; y2=3*scalePb; case 3 x2=3*scalePb; y2=3*scalePb; case 4 x2=1*scalePb; y2=2*scalePb; case 5 x2=2*scalePb; y2=2*scalePb; case 6 x2=3*scalePb; y2=2*scalePb; case 7 x2=1*scalePb; y2=1*scalePb; case 8 x2=2*scalePb; y2=1*scalePb;
  • 18. case 9 x2=3*scalePb; y2=1*scalePb; end switch Bc case 1 x3=1*scalePc; y3=3*scalePc; case 2 x3=2*scalePc; y3=3*scalePc; case 3 x3=3*scalePc; y3=3*scalePc; case 4 x3=1*scalePc; y3=2*scalePc; case 5 x3=2*scalePc; y3=2*scalePc; case 6 x3=3*scalePc; y3=2*scalePc; case 7 x3=1*scalePc; y3=1*scalePc; case 8 x3=2*scalePc; y3=1*scalePc; case 9 x3=3*scalePc; y3=1*scalePc; end end %Nikolas Simon %circle.m %plotting function to show the trilateration calculation graphically %accepts the three reference xy values and thier respective distances, the
  • 19. %input variables a,b,c represent which subplot is being plotted, theLabel %is an input string for each subplot title, ux and uy are the calculated %coordinates of the unknown node indicated graphically by an asterisk function circle(x1,y1,r1,x2,y2,r2,x3,y3,r3,a,b,c,theLabel,ux,uy) hold on subplot(a,b,c); th = 0:pi/50:2*pi; %circle 1 xunit1 = r1 * cos(th) + x1; yunit1 = r1 * sin(th) + y1; %circle 2 xunit2 = r2 * cos(th) + x2; yunit2 = r2 * sin(th) + y2; %circle 3 xunit3 = r3 * cos(th) + x3; yunit3 = r3 * sin(th) + y3; plot(xunit1, yunit1,xunit2, yunit2,xunit3, yunit3); grid on title(num2str(theLabel)); text(ux,uy,'*'); hold off %Nikolas Simon %testscript.m %test fixture for the calculation functions
  • 20. %display two different figures using the same circle plotting function, the %trilateration results using the friis equation for distance and the signal %path exponent equation for distance %define constant values h=5;%set room height to 5m wavelength=0.3279;%meters transmit_p=10;%dBm gain=9.6899;%antenna gain dB ref_recieved_pwr=1;%dBm %user entered recieved power levels % sample values used in documentation -11,-14,-13,-20,-4,-1,-9,- 3,-9 p1 = input('Enter Power Value 1: '); p2 = input('Enter Power Value 2: '); p3 = input('Enter Power Value 3: '); p4 = input('Enter Power Value 4: '); p5 = input('Enter Power Value 5: '); p6 = input('Enter Power Value 6: '); p7 = input('Enter Power Value 7: '); p8 = input('Enter Power Value 8: '); p9 = input('Enter Power Value 9: '); %call to the sorting function [Pa Ba Pb Bb Pc Bc]=sort_pr(p1,p2,p3,p4,p5,p6,p7,p8,p9); %call to the mapping function [x1 y1 x2 y2 x3 y3]=power_to_xy(Ba,Bb,Bc); %friis distance calculation [d1 d2 d3] = power_to_d_friis(Pa,Pb,Pc,wavelength,gain,transmit_p); %signal decay exponent distance calculation [Ed1 Ed2 Ed3] = distance_confirm(Pa,Pb,Pc,ref_recieved_pwr); %calls to the trilateration function using [ x_1, y_1, z_1 ] = trilat2d(x1, x2, x3, y1, y2, y3, d1, d2, d3, h);
  • 21. [ x_2, y_2, z_2 ] = trilat2d(x1, x2, x3, y1, y2, y3, Ed1, Ed2, Ed3, h); %plot the xy point on the graph circle(x1,y1,d1,x2,y2,d2,x3,y3,d3,1,2,1,'Trilateration Using Friis Distance',x_1,y_1); circle(x1,y1,Ed1,x2,y2,Ed2,x3,y3,Ed3,1,2,2,'Trilateration Using Signal Path Exponent Distance',x_2,y_2); %display relevant distance and xy values to the command window disp('x y z coordinates Friis') disp(x_1); disp(y_1); disp(z_1); disp('x y z coordinates signal decay exponent') disp(x_2); disp(y_2); disp(z_2); disp('Friis d values') disp(d1); disp(d2); disp(d3); disp('path exponent d values') disp(Ed1); disp(Ed2); disp(Ed3);