フィルターのクリア

using fsolve with nonlinear equations arise in loops

1 回表示 (過去 30 日間)
salman yazdani
salman yazdani 2019 年 6 月 30 日
コメント済み: salman yazdani 2019 年 6 月 30 日
Consider the following problem
Agg=@(co) [co(1)+co(2)-3; co(1)-co(2)-1];
r=fsolve(Agg,[0 0 ]);
This solve the system and obtain the results easily. But if we want the Agg function calculated in a previous loop e.g from an algebraic equation so I can not define variables as co(1) co(2) etc.
the problem get the form
co=sym('co',[1 2]);
Agg(1)=int(...)
Agg(2)=int(...)
r=fsolve(Agg,[0 0 ]);
but this dont work as Agg takes the form [co1+co2-3; co1-co2-1] but matlab needs to be [co(1)+co(2)-3; co(1)-co(2)-1].
What should I do to rplace co1 by co(1). subs and others dont work as co is not define befor

採用された回答

Matt J
Matt J 2019 年 6 月 30 日
r=fsolve(matlabFunction(Agg),[0 0 ]);
  3 件のコメント
Matt J
Matt J 2019 年 6 月 30 日
r=fsolve(matlabFunction(Agg,'Vars',{[co1,co2]}),[0 0]);
salman yazdani
salman yazdani 2019 年 6 月 30 日
Really Thanks dear Matt. I apreciate your kind and valuable help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by