Error using MATLAB fsolve function and not sure why.
1 回表示 (過去 30 日間)
古いコメントを表示
Im having trouble with an error using the function fsolve for a system of equations.
f = @(x) [h*(Tinf-T1)+ep*sigma*Ts-ep*sigma*x(2)-x(1); x(1)*(1/rr+1/rc)-(x(2)-Ts); x(1)*r2-(x(3)-x(2)); x(1)*r3(x(4)-x(3))];
x = fsolve(f, [1 1 1 1]);
the error is
Error in Me603HW55 (line 43)
x = fsolve(f, [1 1 1 1]);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
0 件のコメント
回答 (1 件)
Walter Roberson
2022 年 4 月 23 日
x(1)*r3(x(4)-x(3)
That code tries to index r3 at location x(4)-x(3)
Remember, MATLAB has absolutely no implied multiplication. NAME(EXPRESSION) is always either array indexing or function invocation, and never means multiplication of the content of NAME by the EXPRESSION .
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!