I have N
GPS coordinates with N
distances given to an unknown position which I wish to determine.
My first approach was to use just three p
I followed @zerm's code shown above and it worked fairly well (yellow is calculated point from 3 towers). Results are shown in the Folium snippet. Multilateration using linalg.SVD
However, when I followed the same algorithm with the changes that @mcdowella suggested (#2) using the Least Squares of an MxN System solution, results are much better. Multilateration using Least Squares MxN
Here is the amended code:
A = []
b = []
for m in range(0,len(P)):
x = P[m][0]
y = P[m][1]
z = P[m][2]
Am = 2*x
Bm = 2*y
Cm = 2*z
Dm = R*R + (pow(x,2)+pow(y,2)+pow(z,2)) - pow(dists[m],2)
A += [[Am,Bm,Cm]]
b += [[Dm]]
# Solve using Least Squares of an MxN System
# A*x = b --> x = (ATA)_inv.AT.b = A+.b
A = np.array(A)
b = np.array(b)
AT = A.T
ATA = np.matmul(AT,A)
ATA_inv = np.linalg.inv(ATA)
Aplus = np.matmul(ATA_inv,AT)
x = np.matmul(Aplus,b)
# convert back to lat/long from ECEF
# convert to degrees
lat = math.degrees(math.asin(x[2] / R))
lon = math.degrees(math.atan2(x[1],x[0]))
I'm still exploring other multilateration methods but this post really allowed me to understand the basics of N-points MLAT. Thanks!