I want to solve a system of non linear equations using fsolve but it seems like it's not working well. You can see the code below:
function f = myfun2(x)
mu_ = astro_constants(13);
re_ = astro_constants(23);
deg_ = pi / 180;
ra_ = 35785.922;
fpa_entry_ = -4.0;
sin_theta_e_ = ( - sqrt( mu_ * ( 2 * x(1) * re_ - re_ ^ 2 - x(1) ^ 2 * ( 1 - x(2) ^ 2 ) ) / ( x(1) * re_ ^ 2 ) ) / x(2) ) * sqrt( ( x(1) * ( 1 - x(2) ^ 2 ) ) / mu_ );
cos_theta_e_ = ( x(1) * ( 1 - x(2) ^ 2 ) / ( x(2) * re_ ) ) - 1 / x(2);
x(1) = ra_ / ( 1 + x(2) );
f = [ tan( fpa_entry_ * deg_ ) - ( x(2) * sin_theta_e_ ) / ( 1 + x(2) * cos_theta_e_ ) ; x(1) - ra_ / ( 1 + x(2) ) ];
My initial guess:
x0 = [ [0 100000] , [0 1] ]
[x, fval] = fsolve(@myfun2,x0)
Can someone let me know why this routine is actually not working?
Thanks for your help,
R.