switch from fsolve to fmincon

Hi, I have an equation like f(x)-c=0 and I would like to find the value of x.
I am using fsolve but as x is between 0 and 1 I would like to use fmincon.
Can you think of a way to model this?
Thanks a lot, Luis.

 채택된 답변

Matt J
Matt J 2013년 3월 24일
편집: Matt J 2013년 3월 24일

0 개 추천

Is x a scalar? If so, fminbnd would probably be enough.
Otherwise, LSQNONLIN with the input arguments lb(i) set to 0 and ub(i) set 1 would probably be the most appropriate.
You could do pretty much the same with FMINCON, with an objective function
fun=@(x) norm(f(x)-c)^2
but that seems like overkill. You would basically be reinventing LSQNONLIN.

댓글 수: 1

Luis
Luis 2013년 3월 24일
Yes, x is an scalar. I see now, thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

질문:

2013년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by