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.