MATLAB: Switch from fsolve to fmincon fmincon fsolve 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. Best Answer 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)^2but that seems like overkill. You would basically be reinventing LSQNONLIN. Related SolutionsMATLAB: Force fsolve termination if not progressing Use an output function to terminate the iterations early, if you like.Alan WeissMATLAB mathematical toolbox documentation MATLAB: Lsqnonlin set some parameters constant and others nonconstant Yes, assuming there are no finite bounds you'd like to place on them. Related QuestionMinimize a function to a desired valueGA optimization inequality constraintsUse fsolve with boundariesFmincon check Hessian (in DerivativeCheck)How to use fsolve with constraintsFmincon and fminimax as optimisersHow to solve a system of equations with a constraint
Best Answer