# Iteration based positioning on Matlab - retrieving coordinates between iterations

This is my first question on SE so let me know if I'm not asking my question in the right place.

So basically, I have an algorithm which uses UMTS measurement events for positioning estimation, which I'm in the process of programming in Matlab.

Specifically, I take as an input, among other things, the LL coordinates of the first estimation. The first step is computing τk(i) = || yNB(i) -yk || / c (where yk is the position). I use the haversine formula to find the distance between yNB and yk.

Eventually, I get to the last step which is a minimizing a cost function:

``````ρk =|| {rk (1,2) − dk (1,2)
rk (1,3) − dk (1,3)
. . .
rk (i,j) − dk (i,j)} ||
``````

where dk (i,j) = || yNB(i) - yk || - || yNB(j) - yk ||

Then, the new estimation of yk is used on the next iteration to compute a better value for τk and so on.

So my question is, how do I "retrieve" yk to use on the next iteration? Because by calculating the distance at the first step I "lose" the position ( i use a function like: Distance=Haversine(lat1,long1,lat2,long2)).

Plus, what's the best way to program the cost function minimization in Matlab? Does anyone have an idea of how I can make this work? Thank you!

EDIT: I was told that my "minimizing a cost function" problem might be actually an RLS problem: if find a way to convert to an (X,Y) system instead of (LAT,LONG), I'll have a system of equations as follows:

``````ρk =|| {rk (1,2) − dk (1,2)
rk (1,3) − dk (1,3)
. . .
rk (i,j) − dk (i,j)} ||
``````

where:

``````rk(i,j) = c (TOTD, k (i) - TOTD, k (j) - TRTD(i,j))
dk (i,j) = || yNB(i) - yk || - || yNB(j) - yk ||
``````

With the objective of minimizing k. Right?

I have values for c (velocity), TOTD and TRTD (time differences), and yNB=[XYNB YYNB] (position), so all I'm missing is the position vector yk=[X Y]...

Since || P1 - P2 || is sqrt((x1-xo)^2 + (y1-y0)^2), by either:

A: linearizing the equations as a Taylor series and then applying linear RLS B: applying nonlinear RLS

I should be able to retrieve the values yNB=[XYNB YYNB], right? How can I program it (either via A or B)?

PS: I'm working with distances never bigger than 10km, and I'm not taking altitude into account (2D level)

-
you can make a temp variable to store yk? also, your min cost flow looks a simple curve fitting prob. Say y = Ax; where A is redundancy matrix, y is set of observations; then in matlab you can do x=y\A; (which is a least square estimation). Please explain if i get it right. – Naresh Jul 22 '13 at 10:22
My problem is not the storing itself, it's that I need to make sure that the position variable changes on each iteration. Because || yNB(i) - yk || is actually a distance, and I'm not seeing how I can make it change! – TFSP Jul 22 '13 at 14:39
Also, I should probably do all of this in ECEF, right? – TFSP Jul 23 '13 at 0:38
coordinates should not be a problem. Once you have distances, you have your network. you solved? If not, put some details about how you are implementing. I will have a look in the evening again. Hopefully I can help. – Naresh Jul 24 '13 at 13:53
Thank you! I edited the question for you. – TFSP Jul 25 '13 at 2:26