필터 지우기
필터 지우기

fsolve

조회 수: 1 (최근 30일)
Romain W
Romain W 2011년 7월 20일
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
the cyclist
the cyclist 2011년 7월 20일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by