Borrar filtros
Borrar filtros

fsolve

1 visualización (últimos 30 días)
Romain W
Romain W el 20 de Jul. de 2011
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.
  1 comentario
the cyclist
the cyclist el 20 de Jul. de 2011
Can you please include the values of all constants (e.g. "astro_constants")?
Also, what do you mean by "not working"? Does it give an error or warning, or just not give the answer you expect?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Manual Performance Optimization en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by