I want to solve a set of non linear equations in matlab. I mean lets say I have two points defined by (lat1,lon1) and (lat2,lon2). Now I want to find a point lat3,lon3 such that it is at a distance of 20km from both of the points. It is given by the intersection of the circles with radius 20km drawn with points (lat1,lon1) and (lat2,lon2) as center.
However, I am a bit confused about how to solve this equation.
I have the function to calculate the distance between two points in matlab
function [ distance ] = calculateDistance( latitude1,longitude1,latitude2,longitude2 )
radius = 6371;
dLat = degtorad(latitude2-latitude1);
dLon = degtorad(longitude2-longitude1);
a = sin(dLat/2) * sin(dLat/2) + cos(degtorad(latitude1)) * cos(degtorad(latitude2)) * sin(dLon/2) * sin(dLon/2);
c = 2 * atan2(sqrt(a), sqrt(1-a));
distance = radius * c;
end
and I am trying to use the solve function of matlab available at http://www.mathworks.com/help/toolbox/symbolic/solve.html
However when I define
syms lat3 lon3
and try to get the equations to pass to the solve function it throws the error that
atan2 only accepts arguments of type sym
.
How can I over this?