MATLAB Function Reference    

Minimize a function of one variable



x = fmin('fun',x1,x2) returns a value of x which is a local minimizer of fun(x) in the interval .

x = fmin('fun',x1,x2,options) does the same as the above, but uses options control parameters.

x = fmin('fun',x1,x2,options,P1,P2,...) does the same as the above, but passes arguments to the objective function, fun(x,P1,P2,...). Pass an empty matrix for options to use the default value.

[x,options] = fmin(...) returns, in options(10), a count of the number of steps taken.


Interval over which fun is minimized.
Arguments to be passed to fun.
A string containing the name of the function to be minimized.
A vector of control parameters. Only three of the 18 components of options are referenced by fmin; Optimization Toolbox functions use the others. The three control options used by fmin are:
  • options(1) -- If this is nonzero, intermediate steps in the solution are displayed. The default value of options(1) is 0.
  • options(2) -- This is the termination tolerance. The default value is 1.e-4.
  • options(14) -- This is the maximum number of steps. The default value is 500.


fmin('cos',3,4) computes to a few decimal places.

fmin('cos',3,4,[1,1.e-12]) displays the steps taken to compute to 12 decimal places.

To find the minimum of the function on the interval (0,2), write an M-file called f.m.

Then invoke fmin with

The result is

The value of the function at the minimum is


The algorithm is based on golden section search and parabolic interpolation. A Fortran program implementing the same algorithms is given in [1].

See Also

fmins, fzero, foptions in the Optimization Toolbox (or type help foptions).


[1]  Forsythe, G. E., M. A. Malcolm, and C. B. Moler, Computer Methods for Mathematical Computations, Prentice-Hall, 1976.

  flow fminbnd