MATLAB: Minimizing a function with one variable minimizationoptimization Hello expert, I have to minimize the following function : but i have just this constraint : p, w, c are constants thank you in advance for answering me Best Answer Is this what you're looking for?p = pi;w = 9*pi/56;c = 5;rmin = -40;rmax = 40;% inline functionfun = @(x)(0.5*p*x + 0.5*w*(x-c)^2);options = optimset('PlotFcns',@optimplotfval,'TolX',1e-20,'MaxIter',50000);% minimization[r,fval,exitflag,output] = fminbnd(fun,rmin,rmax,options);disp(['Value of r = ' num2str(r)]); Related SolutionsMATLAB: Error for ‘fmincon’ for global optimization It's a case sensitivity issue. Instead of 'LB' and 'UB', pass in 'lb' and 'ub'. MATLAB: Bug fminbnd not working No bug. fminbnd is a local minimizer, not a global minimizer. Related QuestionError using fminbnd function
Best Answer