Appendix

advertisement
Supervisors:
Zoltan Safar
John Aa. Sorensen
Group members: Xu Li
Wei Zhou
Date: 19/12/03
Table of contents
Abstract ............................................................................................................................... 3
Introduction ......................................................................................................................... 3
Description of the problem ................................................................................................. 3
Review of the outdoor positioning methods ................................................................... 4
Hyperbolic-hyperbolic positioning algorithm..................................................................... 6
Problem setup.................................................................................................................. 6
Mathematical analysis ..................................................................................................... 6
Mathematical modeling .............................................................................................. 6
Find solution ............................................................................................................... 8
Implementation ................................................................................................................. 13
Simulation ......................................................................................................................... 16
Purpose of the simulation.............................................................................................. 16
Initialize the GSM system with sensors and mobile ..................................................... 16
Description of the function of simulation ..................................................................... 17
Result and conclusion of the simulation ....................................................................... 18
Appendix ........................................................................................................................... 24
Appendix A (make_sensor) .......................................................................................... 24
Appendix B (make_TDOA) .......................................................................................... 25
Appendix C (make_q) ................................................................................................... 25
Appendix D (far_find) .................................................................................................. 26
Appendix E (near_find) ................................................................................................ 28
Appendix F (calculate) .................................................................................................. 30
Referente ....................................................................................................................... 31
2
Abstract
This report describes the result of the 4-week project of the “Outdoor Positioning
Using the GSM System” held at the IT-University of Copenhagen, winter 2003. It
focuses on an algorithm that is used to derive the position of the mobile device from
the accurate position measurements information obtained using GSM and simulates
how the algorithm works.
Introduction
Description of the problem
Assume that there are M sensors distributed arbitrarily in a 2-D plane as shown in
the following figure. Assume the sensors are located at ( xi , yi ) with known
locations and the measurement information (the time differences of arrival (TDOA))
is obtained from measurements using GSM system. The task is to find the position
of the source (mobile telephone)
Distribution of sensors and mobile in GSM system
3
Review of the outdoor positioning methods
Specification:
The outdoor position methods stated below is referred to as the hand-out material
referencing to: [1] Christopher Drane, Malcolm Macnaughtan, Craig Scott,
“positioning GSM Telephone”, IEEE Communications Magazine, Apríl 1998,
pp.46-59.
There are a variety of ways in which position can be derived from the measurement
of signals, and these can be applied to any cellular system. The most important
measurements are propagation time, time difference of arrival (TDOA), angle of
arrival, and carrier phase which are to be stated in detail in the following. Each
measurement defines a locus on which the mobile phone must lie, the intersection
defines the position of the mobile phone, if the density of the base stations is such
that more measurements are made than required to uniquely define the position, a
least squares approach can be used to combine all the measurements into a more
accurate position estimate. If too few measurements are available, the loci will
intersect at more than one point, resulting in ambiguous position estimates. So it is
important to get the necessary number of measurements.
1. Propagation time
The propagation time is got by measuring the time which takes for a signal to
travel between a base station and a mobile telephone or vice versa (TOA).
Each measurement value of the TOA can generate a circular locus, on which the
mobile must lie, around the base station. The intersection of this kind of three
loci can determine the position of the mobile phone. Such kind of system can
be referred to as a circular-circular-circular system
2. Time difference of arrival (TDOA)
The time difference between each pair of arrivals can be measured, for example,
if there are three base stations, two independent TDOA measurement can be made.
And each TDOA measurement defines a hyperbolic locus on which the mobile
phone must lie, the intersection of the two hyperbolic will define the position
of the mobile phone.
4
3. Angle of arrival (AOA)
The angle of arrival of a signal from a mobile to a sensor can be measured, this
single measurement can produce a straight line locus from the mobile to the
sensor. The intersection of these two kinds of loci can give the position of the
mobile device for this angle-angle system. Of course mixed measurements can be
used to decide the position of mobile telephone, for example, one propagation time
measurement value and angle of arrival measurement value can give a fix position
of the mobile telephone.
The following figure is to give examples of general positioning techniques described
above.
Examples of general positioning techniques
In the above figure, a) propagation time measurements (range); b) TDOA
measurements; c) combination of range and angle measurements;
d)combination of range and angle measurements.
A, B and C represent base stations. The mobile phone is positioned at the
intersection of the loci(X).
5
Hyperbolic-hyperbolic positioning algorithm
In our project, we only concentrate the positioning algorithm in hyperbolichyperbolic system. In this case there are three sensors at least to derive the position
of the mobile device. In this section, we focus on describing the mathematical
method.
The positioning algorithm stated below is referred to as: [2] Y.T.Chan, K.C.Ho,
“A Simple and Efficient Estimator for the Hyperbolic Location”. IEEE Transactions
on Signal Processing, Vol. 42, No. 8, August 1994, pp.1905-1915.
Problem setup
The known parameters:
1. ( xi , yi ) , which are sensors’ location.
2. TDOA, which are obtained from measurement.
3. Q, the auto-covariance matrix of the measurement noise.
The problem to be solved:
( x, y ) , The position of the mobile device.
Mathematical analysis
Mathematical modeling
One of the sensors is set as reference sensors, for example, which we assume is the
first sensor.
1. TDOA and Q.
d i ,1  d i  d1 , where i  2,3  , M , d i ,1 is the TDOA between the sensor i and the
reference sensor. It can be expressed as d i ,1  d i0,1  ni ,1      (4) ,
where d io,1 is the real value, and n i ,1 is the random vector n2,1
n3,1 .... nM ,1 
T
which has zero mean, Gaussian distribution, and covariance matrix Q.
6
This TDOA will be used to calculate the distance differences ( ri ,1  cd i ,1 , where c
is the signal propagation speed).
2. Setup the nonlinear equations and linearization
Mathematical methods are built to solve the given problem. First a set of nonlinear
equations are built to give the relationship between the given known parameters and
the unknowns to be solved.
Setup the nonlinear equations
The nonlinear equations are the distance square between the sensor i and
The mobile device as fellows:
ri 2  ( xi  x) 2  ( y i  y ) 2  K i  2 xi x  2 y i y  x 2  y 2 , i  1,2,...n --------(5)
ri ,1  cd i ,1  ri  r1 ---------(6) where K i  xi2  y i2 .
Linearization
From (6), ri2  (ri ,1  r1 ) 2 , so that (5) can be written as
ri2,1  2ri ,1r1  r12  K i  2 xi x  2 yi y  x 2  y 2 ----------------(8)
Subtracting (5) at i  1 from (8), we obtain
ri2,1  2ri ,1r1  2 xi ,1 x  2 yi ,1 y  K i  K1
--------------(9)
The symbols xi ,1 and yi ,1 stand for xi  x1 and y i  y1 respectively. (9) is a
set of linear equations with unknown x, y and r1 .
Modeling result
The above set of linear equations can be written as:
 x 2,1
x
x
3,1


Ga   y   h where Ga  
 .
r1 

 x n ,1
y 2,1
y 3,1
.
y n ,1
r2,1 
 r22,1  K 2  K 1 
 2

r3,1 
1 r  K 3  K1 
h   3,1
----(11)

. 
.
2
 2


rn,1 
rn ,1  K n  K 1 
So the result of mathematical modelling is that the problem is changed to
solve model equation (11) with matrix.
7
Find solution
This is to solve the above model equation (11) to find the location of the mobile
device ( x, y ) . Because there are three unknowns x, y, r1 in the above model
equation, so there are at least three sensors located in the GSM system,
otherwise the number of the solutions for the unknowns is infinite, and if there
are more than hree sensors, the number of the linear equations are more than the
unknowns. So it divides into two conditions, they are three sensors and more
than three sensors.
a. Three sensors (M=3):
With three sensors, x and y are solved in term of r1 from (9). That is
 x 2,1
 x
 y   x
 
 3,1
1
2
r2,1 
y 2,1 
1 r2,1  K 2  K 1  

r

  1

  --------(10)
y 3,1 
2  r32,1  K 3  K 1  
 r3,1 
inserting this intermediate result into (5) at i=1 gives a quadratic in r1 .
Substitution of the positive root back into (10) produces the solution.
In practice, there are more than three sensors located in the system,
especially if there are three sensors; the accuracy of the result is not so
desirable because of the effect of the noise. We created a function
called “solve3” to solve the problem of this condition, but we do not
state the detail about this condition in this report.
b. Four or more sensors (M>=4)
We use three steps to state how to analyze and solve the problem.
1. Setup the problem.
When there are four or more than four sensors in the GSM system, the
system is over-determined as the number of the measurements is greater
than the number of unknowns. In presence of noise, the set of the
equations in (9) will not meet at the same point and the proper answer is
the ( x, y ) that best fit these equations.
8
We set the unknown vector as z a  x
y r1  . With TDOA noise, the
T
error vector derived from (9) is  = h  Ga z a0 where the Ga and h are the
same as those in (11) respectively.
When (4) is used to express ri ,1 as ri0,1  cni ,1 , and noting from (6) that
ri0  ri0,1  r10 , then  can be expressed as
 = cBn  0.5c 2 n  n

0
0
0
where B  diag r2 , r3 ,..., rM
     (12)
In practice, cni ,1  ri0 is usually satisfied, and the covariance matrix of


 can be given by   E  T  c 2 BQB ---(13)
The elements of z a are related by (5), which means that (11) is still a set
of nonlinear equations in two variables x and y .
2. Solve the problem.
To solve the nonlinear problem, we divide it into two steps; we first
assume that there is no relationship among x , y, and r1 , and then they
can be solved by LS (least squares method) to get an approximate result,
we second impose the known relationship (5) to the computed result via
another LS to get the final true solution. This two step procedure is an
approximation of a true estimator for the mobile location.
First step:
It can be divided into two kinds of assumption conditions.

When the mobile is far or assumed far from the sensors.
In this condition, each ri is close to r 0 so that B  r 0 I where
r 0 designates the range and I is an identity matrix of size M-1. Since the
scaling of  does not affect the answer, an approximation result of
z a can be given by z a  (GaT Q 1Ga ) 1 GaT Q 1 h. ---(14b).
9

When the mobile is close to sensors.
In this situation, we first use the initial solution generated from (14b) to
estimate B in (13). This B can be used in (13) to get  , by considering
the elements of z a independent, the ML estimate of z a is given by
z a  arg min (h  Ga z a ) T  1 (h  Ga z a )

= (GaT  1Ga ) 1 GaT  1 h -----(14a)
Second step:
The result of z a assumes that x, y, and r1 are independent, but they are
related by (5) at i  1 . So the remaining question is how to incorporate
this relationship to give an improved estimate.
When the noises in the TDOA are small, the vector of z a is a random
vector with its mean centered at the true value and the covariance matrix
of z a given by cov( z a )  (GaT  1Ga ) 1    (17) .
It can be expressed as
z a,1  x 0  e1 , z a, 2  y 0  e2 , z a,3  r10  e3    (18)
where e1 , e2 and e3 are estimation error of z a . Subtracting the first two
components of z a by x1 and y1 , and then squaring the elements gives
another set of equations  '  h '  Ga' z a'
 ( z a ,1  x1 ) 2 
1 0
 ( x  x1 ) 2 

'
2
'
where h  ( z a , 2  y1 ) , Ga  0 1, z a'  
-----(19)
2
(
y

y
)
2
1




1 1
z a ,3


where  ' is a vector denoting inaccuracies in z a . Substituting (18) into
(19) gives
 1'  2( x 0  x1 )e1
 2'  2( y 0  y1 )e2      (20)
 2'  2r10 e3
10
This is another approximation to the true maximum likelihood procedure.
The covariance matrix of  ' is given by


 '  E  ' T  4 B ' cov( z a ) B '

B '  diag x 0  x1 , y 0  y1 , r10
      (21)
The ML estimate of z a' is also divided into two conditions;

When the mobile is close to the sensors.
In this condition, z a' is given by
z a'  (Ga'T  '1Ga' ) 1 Ga'T  '1 h ' .        (22a)
where B ' can be approximated by using the values in z a , B in (13) can
be obtained from the values from (14b). The final position estimate is
then obtained from z a' as
x 
z p  z a'   1 
 y1 
or
x 
z p   z a'   1       (24)
 y1 

When the mobile is far from the sensors.
In this condition, cov( z a )  c 2 r 02 (GaT Q 1Ga ) 1 , so the (22a) reduces to
z a'  (Ga'T B '1GaT Q 1Ga B '1Ga' ) 1 (Ga'T B '1GaT Q 1Ga B '1 )h '    (22b)
The final position estimate is then obtained from z a' as
x 
z p  z a'   1 
 y1 
or
x 
z p   z a'   1       (24)
 y1 
11
In the above two conditions, the final position estimate has four possible
answers, we select the one which is the nearest to the approximate result of
(14b) or (14a) as the final true position; if in the first step the mobile is
assumed far from the sensors, the approximate result of (14b) is used to
decide which is the desired final position of the mobile, if the mobile is not
assumed far from the sensors, the approximate result of (14a) is used to decide
which is the desired final position of the mobile.
3. general conclusion
There are two ways to find the final solution of the mobile location; the first is
called far which can be realized by executing the calculation from (14b) to (22b)
followed by (24), the second is called near which has the different order of the
implementation, it is from (14b) back to (14a), and then (22a) followed by (24).
These two ways will be implemented using Matlab.
12
Implementation
Functions are used to show how the simulation works clearly and correctly.
make_sensor
Input:

n , the number of the sensors that the user wants to choose for simulation.
Output

xi
yi  , the sensors’ known location matrix with 2 columns and i rows.

xm
y m  , the assumed location vector of the mobile.
T
Main variables
 ( xi , yi ) , the given coordinates of the sensors.

( xm , y m ) , the assumed coordinate of the mobile.
Function description
This function is created with the purpose of simulation. Assume that there are 10
sensors located in the system with coordinates ( xi , yi ) respectively and one mobile
located at ( x, y ) . This model will put the first m locations
of the sensors into vector xi , y i  , i  1,2....m , if the user chooses m number of sensors
(m<=10), then return xi , y i  and x
y .
More detail about this model is given from the matlab file “make_sensor.m” in
the Appendix A.
make_TDOA
Input:

xi , yi  , the sensors’ known location matrix, where i  1,2.......M , which is
got from the output of the function “make_sensor”.

Sigma_square (  d ), which is used to set the noise power.
2
13

xm
y m  , the assumed location vector of the mobile device, which is got
T
from the output of the function “make_sensor.m”.
Output:

TDOA
d i ,1  d i  d1 , i  2,3.....M , d i ,1 is the TDOA column vector, M is the number of the
sensors.
Function description
This function is created with the purpose of simulation. It calculates the distance
difference ( ri ,1 ) between the ith sensor and the reference sensor (the first sensor). Then
d 0 i ,1 is got by dividing ri ,1 by c , and add the random Gaussian noise to d 0 i ,1 . So the
output of this model is: d i ,1  d i0,1  ni ,1 , with noise
n i ,1 = sqrt(sigma_square)*randn (randn is normal distribution random matlab function).
More detail about this model can get from the matlab file “make_TDOA.m” in
the appendix B.
make_q
Input:

TDOA, this can be got from the output of the model “make_TDOA”.
Output

Q, which is covariance matrix of TDOA.
Function description
This function is to create covariance matrix of TDOA, which is an identity
matrix with the length the same as the row number of TDOA. More detail
about this model can get from the matlab file “make_q” in the appendix C.
14
far_find
Input:

xi
yi  . It is the sensors’ known location matrix, which can be got from the
output of the model “make_sensor”.

TDOA. This can be got from output of the model “make_TDOA”.

Q. It is covariance of TDOA, and it can be got from the output of the model
“make_q”.
Output:

( x, y ) , the location of the mobile device.
Function description
This model is to calculate the final solution of the mobile location, it follows the
far way described before. It calculates the Ga and h , then it gets the approximate result
by calculating (14b), then get the improved final result by calculating (22b) followed by
(24). More detail is given from the matlab file “far_find.m” in the appendix D.
near_find
The inputs and output to this model are the same as the model “far_find”.
But this model uses the second way near to find the final solution of the mobile
location.It calculates the Ga and h , then it gets the approximate result by calculating
(14b), the result from (14b) is taken back to (14a) to get the new approximate result from
(14a), then get the improved final result by calculating (22a) followed by (24). More
detail is given from the matlab file “near_find.m” in the appendix E.
15
Simulation
Purpose of the simulation
The purpose of simulation is to use the built function to simulate how the described
algorithm find the location of the mobile, and to find the relationship between
MSRE(mean square root error of the distance between the calculated value and the real
value) and sigma square (the noise power).
The error of the distance between the calculated value and the real value is calculated as:
e  ( x  xm ) 2  ( y  y m ) 2 where ( x, y ) is the calculated location, ( xm , y m ) is the real
location.
Initialize the GSM system with sensors and mobile
To simulate, first we set the locations of the sensors, we assume that there are 10 sensors
located at the points s1 (0,0) , s2 (5,8) , s3 (4,6) , s4 (2,4) , s5 (7,3) , s 6 (7,5) ,
s7 (2,5) , s8 (4,2), s9 (3,3) , s10 (1,8) in the 2-D plane respectively, and s1 (0,0) is selected
as the location of the reference sensors, and we assume a mobile phone is located at
m(8,22) , of course, we can change the distribution of the sensors and the location of
the mobile.
The distribution of the sensors is shown as the following figure.
The distribution of the sensors in the GSM
16
Description of the function of simulation
The simulation below is to show how to calculate MSRE with respect to different
sigma square and plot the maps showing the relationship between MSRE and sigma
square.
We create an function called “calculate(m, n).m”, which is placed in the appendix F, to
realize the above simulation task.
Specification: The two parameters “m” and “n” allow you to select different number
of the sensors to be used for calculation, which means when the user set the value for
“m” and “n”, the value of “m” is sent to the function “make_sensor(m)” , the result of
the function “make_sensor(m)” is to return a vector with m sensors’
locations, the program rans with m sensors to calculate the MSRE, and at the same
time the function “make_sensor(n)” is invoked with parameter of n, the program rans
with n sensors to calculate the MSRE.
The purpose of setting two parameters for this function is that we can easily get
the difference from the results of simulation with different number of sensors.
The implementation of the function is stated in detail as follows:
1. The functions “ make_sensors”, “make_TDOA” and “make_q” are called
to give the required input parameters to the calculation functions “far_find” and
“near_find”.
2. Those two functions “far_find” and “near_find” are called to find the final
solution of the mobile location for the different selection of the number of
sensors.
3. The functions “far_find” and “near_find” run 2000 times respectively with respect
to “m” and “n” for each assumed sigma, and the mean value of the distance
between the real mobile location and the calculated location is calculated and
saved into four vectors respectively.
17
4. Increase the value of the sigma, execute step 3.
5. Repeat step 4 and step3 for 15 times to get four vectors with 15 MSRE value
according to 15 different increasing sigma values.
6. Plot the MSRE values in the four vectors with respect to sigma, there are four
curves divided into two groups with two curves for each, the one group are related
to “m”, the other are related to “n”. in each group, one curve is the result of the
“near” , the other is the result of “far”.
Result and conclusion of the simulation
We divide the simulation with respect to different conditions.
The returned answer shown in the simulations is the result of the last calculation of the
implementation in relation to “near” way, “n” sensors and the largest sigma square.
In the following figures, there are four curves with different identity symbols to show
the different results from different simulation conditions.
The curve plotted with the symbol “ +” is the result from “near” with the number of
“m” sensors selected to calculate the solution of the mobile location; The curve plotted
with the symbol “*” is the result from “far” with the number of “m” sensors;
the curve plotted with the symbol “Δ” is the result from “near” with the
number of “n” sensors; the curve plotted with the symbol “‫ ” ڤ‬is the result from
“far” with the number of “n”sensors.
1. When the mobile is located near to the sensors, for example,
The location of the mobile is: x=8, y=22. And ran function “calculate(m,n)” in the
command window of Matlab.
In this condition, we set the initial sigma square 1/10^20, we select different
values for m and n.
>> res=calculate(4,7)
res =
7.3530
20.7822
18
Figure (1)
>>res=calculate(7,10)
res =
7.7329 21.6970
Figure (2)
19
Conclusion 1:
From the figure (1) and (2), it can be seen:
1. When the sigma square increases, the MSRE increases.
2. When a few sensors are used to calculated, the “near” is a little better than
the “far”. This point can be seen from figure (1).
3. More sensors are used, the MSRE are less, which means the solution of the
mobile location are more accurate. Especially from the figure (2), you can
see all the four curves are almost the same and the MSRE are very small
(less than 1.2 meters).
So in real life, in order to get more accurate result, more than 6 sensors should be
used to calculate the location of the mobile, and when the mobile is located near
to the sensors, the accuracy of positioning is very high and reliable.
2. We assume the mobile is located far from the sensors, for example,
The location of the mobile is: x=50, y=-200, and the sigma square is the same as
before, it is 1/(10^20)
In this condition, we select different values for m and n.
>> res=calculate(7,10)
res = +13.2308i 0 +49.7344i
Figure (3)
20
The MSRE in figure (3) are too big with respect to the set sigma square and the
returned answer is wrong.
To solve the problem happened in figure (3), we think because all of the sensors
are located near to each other around the origin of the plane, when the mobile is
move far from the sensors, the TDOA becomes smaller, and the effect of the noise
with the given power increases, so we find two ways to solve the above problem.
One is to decrease the noise power, the other is to redistribute the sensors with the
purpose of increase the TDOA.
a). We decrease the value of the sigma square, it is set to be 1/(10^23). The test
result is show below.
>>res=calculate(7,10)
res =
50.2399 -200.7955
Figure (4)
The simulation result with decreased sigma square
21
b). We redistribute the sensors to make the mobile “near” to the
GSM system.
The new distribution of the sensors referred to above is shown below.
the new distribution of the sensors in GSM system
We simulate with new distribution and the old sigma square, the result is show
In the next page.
22
>> res=calculate(7,10)
res =
50.7298 -206.5373
Figure (5)
The simulation result with new distribution of the sensors
Conclusion 2:
When the mobile is “far” from the sensors, the solution of the location may not be
found correctly. There are two ways to solve this kind problem in real life.
1. Improve the accuracy of the measurement to reduce the measurement noise.
2. Design best distribution of the sensors for the GSM system to the mobile
“near” to the GSM system .
23
Appendix
Appendix A (make_sensor)
The function “make_sensor(m).m” is shown as follow.
function [sensors,mobile]=make_sensor(m)
%-----set locations for 10 sensors-----tmp=zeros(10,2);
tmp(1,1)=0; tmp(1,2)=0;
tmp(2,1)=-5; tmp(2,2)=8;
tmp(3,1)=4; tmp(3,2)=6;
tmp(4,1)=-2; tmp(4,2)=4;
tmp(5,1)=7; tmp(5,2)=3;
tmp(6,1)=-7; tmp(6,2)=5;
tmp(7,1)=2; tmp(7,2)=5;
tmp(8,1)=-4; tmp(8,2)=2;
tmp(9,1)=3; tmp(9,2)=3;
tmp(10,1)=1; tmp(10,2)=8;
sensors=zeros(m,2);
%------put the first m sensors' locations into
%a matrix with m rows and two columns
for i=1:m
sensors(i,1)=tmp(i,1);
sensors(i,2)=tmp(i,2);
end
%---------set the assumed mobile location------mobile=zeros(2,1);
mobile(1,1)=8;
mobile(2,1)=22;
24
Appendix B (make_TDOA)
function [tdoa]=make_TDOA(sensors,mobile,sigma_square)
[m,n]=size(sensors);
tdoa=zeros(m-1,1);
c=3*10^8; %the signal speed
for i=1:m-1
tmp=sqrt((sensors(i+1,1)-mobile(1,1))^2+(sensors(i+1,2)-mobile(2,1))^2)sqrt((sensors(1,1)-mobile(1,1))^2+(sensors(1,2)-mobile(2,1))^2);
tdoa(i,1)=tmp/c+sqrt(sigma_square)*randn;
end
Appendix C (make_q)
function [Q]=make_q(tdoa)
[m,n]=size(tdoa);
Q=zeros(m,m);
for i=1:m
for j=1:m
if(i~=j)
Q(i,j)=0;
else
Q(i,j)=1;
end
end
end
25
Appendix D (far_find)
% specification: all the index number used in this file are referred to as those in the
% reference material handed out by supervisors.
%This is far way to find the final solution of the mobile location,
%it assume that the mobile is far away from the sensors. it is called far way
%the step of calculation is 14b, 22b and then 24.
function [x,y]=find_persion(sensors,TDOA,Q)
c=3*10^8;
Ri1=c*TDOA;
h=zeros(size(TDOA));
[m,n]=size(TDOA);
Ga=zeros(m,3);
%-----------the following is to create the matrix h and Ga reference to (11)----------%
for i=1:m
h(i,1)=0.5*(Ri1(i)^2(sensors(i+1,1)^2+sensors(i+1,2)^2)+(sensors(1,1)^2+sensors(1,2)^2));
Ga(i,1)=sensors(i+1,1)-sensors(1,1);
Ga(i,2)=sensors(i+1,2)-sensors(1,2);
Ga(i,3)=Ri1(i);
end
Ga=-Ga;
Za=zeros(3,1);
%the following equation is referred to as (14b), that assumes all the sensors are far from
the
%mobile device.
%--------------------Za=inv((Ga'*inv(Q)*Ga))*Ga'*inv(Q)*h;%(14b)
%--------------------%the following calculation is to improve the approximate result from (14b)
x=Za(1,1);
y=Za(2,1);
r=Za(3,1);
%--------------------%--------------------%--------------------Ga2=[1,0;0,1;1,1];
Za2=zeros(2,1);
h2=zeros(3,1);
26
h2(1,1)=(x-sensors(1,1))^2;
h2(2,1)=(y-sensors(1,2))^2;
h2(3,1)=r^2;
B2=zeros(3,3);
B2(1,1)=x-sensors(1,1);
B2(2,2)=y-sensors(1,2);
B2(3,3)=r;
%--------------------Za2=inv(Ga2'*inv(B2)*Ga'*inv(Q)*Ga*inv(B2)*Ga2)*(Ga2'*inv(B2)*Ga'*inv(Q)*Ga*i
nv(B2))*h2;%(22b)
%--------------------x1=sqrt(Za2(1,1))+sensors(1,1);%(24)
x2=-sqrt(Za2(1,1))+sensors(1,1);%(24)
y1=sqrt(Za2(2,1))+sensors(1,2);%(24)
y2=-sqrt(Za2(2,1))+sensors(1,2);%(24)
% there are four possible results which are (x1,y1),(x1,y2), (x2,y1), (x2,y2), we
% selcet the one which is the nearest to the proximate result acquired from 14(b)
% as the desired result.
res11=sqrt((x1-Za(1,1))^2+(y1-Za(2,1))^2);
res12=sqrt((x1-Za(1,1))^2+(y2-Za(2,1))^2);
res21=sqrt((x2-Za(1,1))^2+(y1-Za(2,1))^2);
res22=sqrt((x2-Za(1,1))^2+(y2-Za(2,1))^2);
resV=[res11 res12 res21 res22];
minxy=min(resV);
if(res11==minxy)
x=x1;
y=y1;
elseif(res12==minxy)
x=x1;
y=y2;
elseif(res21==minxy)
x=x2;
y=y1;
elseif(res22==minxy)
x=x2;
y=y2;
end
27
Appendix E (near_find)
% specification: all the index number used in this file are referred to as those in the
% reference material handed out by supervisors.
%This is far way to find the final solution of the mobile location,
%it assume that the mobile is close to the sensors. it is called near.
%the step of calculation is 14b, 14a, 22a and then 24.
function [x,y]=find_persion(sensors,TDOA,Q)
c=3*10^8;
Ri1=c*TDOA;
h=zeros(size(TDOA));
[m,n]=size(TDOA);
Ga=zeros(m,3);
for i=1:m
h(i,1)=0.5*(Ri1(i)^2(sensors(i+1,1)^2+sensors(i+1,2)^2)+(sensors(1,1)^2+sensors(1,2)^2));
Ga(i,1)=sensors(i+1,1)-sensors(1,1);
Ga(i,2)=sensors(i+1,2)-sensors(1,2);
Ga(i,3)=Ri1(i);
end
Ga=-Ga;
Za=zeros(3,1);
%the following equation is referred to as (14b), that assumes all the sensors are far from
the
%mobile device.
%--------------------Za=inv((Ga'*inv(Q)*Ga))*Ga'*inv(Q)*h; %(14b)
%--------------------%the follow B matrix is referred to as (12), used in (13), acquired by using the
approximate
%value from the above (14b), which is used back to the (14a) to get the approximate
result which
% fit the condiction in which the mobile is close to the sensors.
B=zeros(m,m);
for i=1:m
for j=1:m
if(i==j)
B(i,j)=sqrt((Za(1,1)-sensors(i,1))^2+(Za(2,1)-sensors(i,2))^2);
else
B(i,j)=0;
end
end
end
%--------------------Za=inv((Ga'*inv(B*Q*B)*Ga))*Ga'*inv(B*Q*B)*h;%(14a)
%the following calculation is to improve the approximate value from (14a)
28
%--------------------x=Za(1,1);
y=Za(2,1);
r=Za(3,1);
%--------------------Ga2=[1,0;0,1;1,1];
Za2=zeros(2,1);
h2=zeros(3,1);
h2(1,1)=(x-sensors(1,1))^2;
h2(2,1)=(y-sensors(1,2))^2;
h2(3,1)=r^2;
B2=zeros(3,3);
B2(1,1)=x-sensors(1,1);
B2(2,2)=y-sensors(1,2);
B2(3,3)=r;
Fi=4*B2*inv(Ga'*inv(B*Q*B)*Ga)*B2;
Za2=inv(Ga2'*inv(Fi)*Ga2)*Ga2'*inv(Fi)*h2;%(22a)
x1=sqrt(Za2(1,1))+sensors(1,1);%(24)
x2=-sqrt(Za2(1,1))+sensors(1,1);%(24)
y1=sqrt(Za2(2,1))+sensors(1,2);%(24)
y2=-sqrt(Za2(2,1))+sensors(1,2);%(24)
% there are four possible results which are (x1,y1),(x1,y2), (x2,y1), (x2,y2), we
% selcet the one which is the nearest to the proximate result acquired from 14(a)
% as the desired result.
res11=sqrt((x1-Za(1,1))^2+(y1-Za(2,1))^2);
res12=sqrt((x1-Za(1,1))^2+(y2-Za(2,1))^2);
res21=sqrt((x2-Za(1,1))^2+(y1-Za(2,1))^2);
res22=sqrt((x2-Za(1,1))^2+(y2-Za(2,1))^2);
resV=[res11 res12 res21 res22];
minxy=min(resV);
if(res11==minxy)
x=x1;
y=y1;
elseif(res12==minxy)
x=x1;
y=y2;
elseif(res21==minxy)
x=x2;
y=y1;
elseif(res22==minxy)
x=x2;
y=y2; end
29
Appendix F (calculate)
function MSE=calculate(m,n)
number=15;
SNR=zeros(number,1);
SNR1=zeros(number,1);
SNR2=zeros(number,1);
SNR3=zeros(number,1);
rpt=2000;
sigma_square=1/(10^20);
for k=1:number
tmp=0;
tmp1=0;
tmp2=0;
tmp3=0;
for i=1:rpt
%----------------m sensors---------------[sen,mobile]=make_sensor(m);
tdoa=make_TDOA(sen,mobile,sigma_square);
Q=make_q(tdoa);
[x,y]=near_find(sen,tdoa,Q);%near, plot with "+" symbol
tmp=sqrt((x-mobile(1,1))^2+(y-mobile(2,1))^2)+tmp;
[x,y]=far_find(sen,tdoa,Q); %far, plot with "*" symbol
tmp1=sqrt((x-mobile(1,1))^2+(y-mobile(2,1))^2)+tmp1;
%------------------n sensors-----------------[sen,mobile]=make_sensor(n);
tdoa=make_TDOA(sen,mobile,sigma_square);
Q=make_q(tdoa);
[x,y]=near_find(sen,tdoa,Q);%near
tmp2=sqrt((x-mobile(1,1))^2+(y-mobile(2,1))^2)+tmp2;
[x,y]=far_find(sen,tdoa,Q);%far
tmp3=sqrt((x-mobile(1,1))^2+(y-mobile(2,1))^2)+tmp3;
end
sigma_square=sigma_square+1/(10^20);
MSE=tmp/rpt;
SNR(k,1)=MSE;
MSE1=tmp1/rpt;
SNR1(k,1)=MSE1;
30
MSE2=tmp2/rpt;
SNR2(k,1)=MSE2;
MSE3=tmp3/rpt;
SNR3(k,1)=MSE3;
end
MSE=[x,y];
x=[1:k];
plot(x,SNR,'c+-',x,SNR1,'b*-',x,SNR2,'rv-',x,SNR3,'gs-');
title('the relation between MSRE and sigma square');
xlabel('sigma-square 10^-20');ylabel('MSRE in Meter');
Referente
[1] Christopher Drane, Malcolm Macnaughtan, Craig Scott, “positioning GSM
Telephone”, IEEE Communications Magazine, Apríl 1998, pp.46-59.
[2] Y.T.Chan, K.C.Ho, “A Simple and Efficient Estimator for the Hyperbolic
Location”. IEEE Transactions on Signal Processing, Vol. 42, No. 8, August 1994,
pp.1905-1915.
31
Download