    Next: Symbolic Math Up: Further MATLAB Previous: Numerical Integration

Optimizing

The function fmin('function', start, finish) will attempt to return the minimum of function (a scalar function of a scalar argument) in the interval [start, finish]. Of course, no numeric method can guarentee a minimum for a function that varies too rapidly.

An optional fourth argument may be given; this is a vector of options (see help foptions). The relevant options for fmin are the first, second, and fourteenth elements in the vector. If and only if element 1 is nonzero, the intermediate steps are displayed (default is 0). Element 2 gives the termination tolerance in the function argument (default ). Element 14 gives the maximum number of steps (default 500). The other elements of the options vector are ignored.

If function takes more than one argument, the others may be specified as constant parameters by fmin('function', start, finish, options, first parameter, second parameter...). This minimizes function(x, first parameter, second parameter...) over .

A function of more than one variable may be similarly minimized with fmins, which uses a simplex search. The basic form is fmins('function', v), which looks for a local minimum near the vector v. The function must still return a scalar.

A vector of options may be passed to fmins exactly as to fmin, with the same meanings and defaults. Parameters may also be passed to fmins as to fmin, except that there is a mandatory empty matrix argument between the options vector and the first parameter.

To maximize a function, minimize its negative.

The function fzero('function', x) seeks a zero of function with x as a starting point. The function must take and return a scalar; there is no vector-argument form of fzero. The value of the function at the returned point may not be exactly zero, but the function will change sign near that point. An optional third argument may be given to specify the convergence tolerance; an optional fourth boolean argument may be given to cause (if nonzero) intermediate printing.

See help optim for the contents of the Optimization Toolbox.    Next: Symbolic Math Up: Further MATLAB Previous: Numerical Integration

sepherke
Sat Mar 21 21:42:28 EST 1998