MATLAB: Fminunc for upper and lower bound variable definition MATLABoptimization Isn't it possible to give upper and lower bound for the variables in the objective function while using fminunc ? Thank you. Best Answer No, fminunc() is for unconstrained optimization. If you want to do constrained optimization, then use fmincon(). Related SolutionsMATLAB: Quasi newton method for NLP code problem Is there any built in function to solve PRSopt_QN with quasi-newton ? Yes, fminunc is a quasi-newton solver,https://www.mathworks.com/help/optim/ug/fminunc.html#responsive_offcanvas MATLAB: Pass a parameter to vector of variables for fmincon Probably the easiest way is to set ‘x0’ appropriately and then bound ‘x(2)’ to be 40:x0 = [20 40 20];lb = [0 40 0];ub = [100 40 100];fun = @(x) x(1)+x(2)+x(3);x_min = fmincon(fun,x0,[],[],[],[],lb,ub) Related QuestionError for ‘fmincon’ for global optimizationFzero of two functions subtractedHow fmincon shifts x0 when it does not strictly satisfy the upper and lower boundsHow to express a constraint with fmincon
Best Answer