1

This question already has an answer here:

The question i am going to ask is very much similar to this question-
How to calculate the intersection of 2 Circles?
But the problem here is, the radius of the spheres are too small (within 8 meter). I have used the Newton-Raphson method with Jackobian matrix to calculate a point which is exist in the intersection area of three spheres.
I have the (lat,long) and a radius for three spheres and may be more. But every time I am getting a matrix which is not invertible. To apply NR method I've first convert the lat,long to x,y,z by this

lat = toRadians(latitude);
lon = toRadians(longitude);
x = earthRadius * cos(lat) * cos(lon);
y= earthRadius * cos(lat) * sin(lon);
z = earthRadius * sin(lat);

and used this as a center of a sphere and use r/1000 as radius (converted to KM) of that sphere. Algorithm starts with an initial point which i have considered the centroid. I guess it is for the Bad Starting Point. The radius is calculated form the signal strength of the different wi-fi access points(AP). The number of spheres are dependent on how many APs are available. Any advice would be helpful for me.
EDIT
The story repeated many times in stack exchange. I have 3 wi-fi APs with known (lat,lng) and using RSSI, I am calculating the distance (i.e. radius) in meter. Now I need to calculate the location of the mobile user. Main problem is the RSSI is fluctuating and in result estimated distance can not be estimated correctly. That's why the spheres are not always intersecting.
But Newton-Raphson should try to find the intersection which is not happening. It throws an error that matrix is not invertible. Generated matrix may be or may not be square. If it is not square then used this.

marked as duplicate by whuber Feb 27 '15 at 16:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 8 m is quite small, so maybe an error in the positionning of the center of your sphere could results in your sphere not intersecting. With such an accuracy, I would not make the assumption that the Earth is a sphere like you do: I would use the ellipsoid. – radouxju Feb 26 '15 at 13:45
  • 1
    Welcome to GIS SE. Note, this topic is also often called trilateration (or sometimes multilateration) and there are many Qs on the site regarding this. – Martin F Feb 26 '15 at 16:24
  • @radouxju I would do exactly the opposite: at this scale the earth's surface is a plane (to accuracy much greater than IEEE double precision roundoff error). Just use Euclidean calculations, either in 3D Cartesian coordinates or in some projection that is conformal within the region. – whuber Feb 26 '15 at 20:09
  • @whuber I think there is an issue with the conversion from lat/long to XYZ, and therefore they are not intersecting. I agree that the surface of the Earth is a plane at this scale, but the elevation above this surface might result in different distances. Lat/long rounding could be another reason. – radouxju Feb 26 '15 at 20:21
  • @radouxju Thank you for the clarification. I cannot tell from the question how the inputs are specified. Your speculations make it clear that we need more information in order to provide a good answer. Somnath, please edit your question to indicate exactly how you are providing the data about spheres. Also tell us how your question differs from the several on this site that provide trilateration solutions. – whuber Feb 26 '15 at 20:22