フィルターのクリア

Error using MATLAB fsolve function and not sure why.

1 回表示 (過去 30 日間)
Hayden Herrick
Hayden Herrick 2022 年 4 月 23 日
回答済み: Walter Roberson 2022 年 4 月 23 日
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.

回答 (1 件)

Walter Roberson
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 .

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by