Constraints with fsolve

How would you all recommend setting constraints while using fsolve? I am trying to use it to solve a multi-variable equation, similar to using Solver in Excel (setting one cell equal to zero by changing several other cells). Could I use conditional statements?
Please note that I am not an experienced matlab user or programmer. (I've just finished my sophomore year in Engineering school.)

1 件のコメント

John  Smith
John Smith 2011 年 6 月 6 日
I meant, setting constraints on the possible values of the variables.

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

回答 (1 件)

John D'Errico
John D'Errico 2020 年 10 月 6 日

0 投票

Fsolve CANNOT have constraints. The use of conditional statements inside your objective would often cause fsolve to fail to properly converge.

2 件のコメント

Jun W
Jun W 2020 年 12 月 30 日
What about reducing the decimal places or reduce resolution (whatever you call it)? Say I have the output x(1)= 1.0000005823241514, x(2) = -4.511476108384046e-15. I just want x(1) to be 1, x(2) to be 0, how do I do that?
Walter Roberson
Walter Roberson 2020 年 12 月 30 日
passing in initial values of type single() might help.

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

カテゴリ

タグ

質問済み:

2011 年 6 月 6 日

コメント済み:

2020 年 12 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by