MATLAB Functions fmin and fmins

 

    Functions fmin and fmins are intended for computing minimizers of the univariate and the multivariate functions,       respectively. 

 

    Function fmin

   The following command  = fmin(' f ', x1, x2) returns a value of x which is a local minimizer of f(x) in the interval x1 < x < x2, where ' f ' is a string containing the name of the objective function to be minimized.

  Example. To find a maximizer of a  function defined in file funct3 choose x1 = 0.3 and x2 = 0.4 and execute

 s = fmin('funct3', 0.3, 0.4)  
 s =  0.3922

Recall that this is the maximization problem, so at the end we have to change sign of the objective value 

 f = -funct3(s)
 f = 3.7996

Function fmins

Command x = fmins(' f ', x0) returns a vector x which is a local minimizer of f(x) near the starting vector x0. ' f ' is a string
containing the name of the objective function to be minimized. f(x) is a scalar valued function of a vector variable.

Example. To find a minimizer of a function defined in file funct4 we choose x0 = [0.5 0.5] to obtain

s = fmins('funct4', [0.5 0.5])

s = 0.8192    0.8192

g = funct4(s)

g = 3.7996