fsolve
2 ビュー (過去 30 日間)
古いコメントを表示
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
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 Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!