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