problem while Solving nonlinear system
古いコメントを表示
Hi I am trying to Solve this nonlinear system but it is showing me this error * * (Not enough input arguments. Error in (line 4) F(1) = 3 x(1)- cos(x(2).*x(3)) - 0.5 ; )***
function F = root3d(x)
F(1) = 3* x(1)- cos(x(2).*x(3)) - 0.5 ; F(2) = x(1).^2-81 .*(x(2)+0.1).^2 + sinx(3) + 1.06; F(3) = exp(-x(1)) * (x(2)) + 20*x(3)+ 9.471 fun = @root2d; x0 = [0,0]; x = fsolve(fun,x0,options)
回答 (1 件)
Star Strider
2018 年 4 月 7 日
This corrected code works for me:
function F = root3d(x)
F(1) = 3* x(1)- cos(x(2).*x(3)) - 0.5 ;
F(2) = x(1).^2-81 .*(x(2)+0.1).^2 + sin(x(3)) + 1.06;
F(3) = exp(-x(1)) * (x(2)) + 20*x(3)+ 9.471
end
fun = @root3d;
x0 = [0,0,0];
x = fsolve(fun,x0);
x =
499.9997e-003 2.6729e-003 -473.6311e-003
You did not include an optimoptions call, so I did not include an ‘options’ structure as a argument to fsolve.
2 件のコメント
marten marten
2018 年 4 月 7 日
Star Strider
2018 年 4 月 7 日
It will work most easily if you save your ‘root3d’ function to its own function file in your MATLAB search path as root3d.m.
If you are not familiar with the MATLAB search path, see the documentation on What Is the MATLAB Search Path? (link) for a full discussion.
There are other ways to work with it as well. See the documentation on Function Basics (link) for details.
カテゴリ
ヘルプ センター および File Exchange で Systems of Nonlinear Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!