Vectorizing fsolve: how to use fsolve on matrices instead of loops with parameters
2 ビュー (過去 30 日間)
古いコメントを表示
Dear All, is it possible to solve with fsolve an equation with 5 parameters using matrices instead of 5 for loops iterating on every combination of these 5 parameters?
0 件のコメント
採用された回答
Walter Roberson
2016 年 7 月 18 日
編集済み: Walter Roberson
2016 年 7 月 18 日
No, it is not.
You can reduce the number of explicit for loops:
[G{1:5}] = ndgrid(Values1, Values2, Values3, Values4, Values5);
results = arrayfun(@(g1,g2,g3,g4,g5) fsolve(... some appropriate arguments...), G{1}, G{2}, G{3}, G{4}, G{5});
0 件のコメント
その他の回答 (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!