Mathematics    

Converting Your Optimization Code to MATLAB Version 5 Syntax

Most of the function names and calling sequences changed in Version 5 to accommodate new functionality and to clarify the roles of the input and output variables.

This table lists the optimization functions provided by MATLAB and indicates the functions whose names have changed in Version 5.

Old (Version 4) Name
New (Version 5) Name
fmin
fminbnd
fmins
fminsearch
foptions
optimget, optimset
fzero
fzero (name unchanged)
nnls
lsqnonneg

This section:

In addition to the information in this section, consult the individual function reference pages for information about the new functions and about the arguments they take.

Using optimset and optimget

The optimset function replaces foptions for overriding default parameter settings. optimset creates an options structure that contains parameters used in the optimization routines. If, on the first call to an optimization routine, the options structure is not provided, or is empty, a set of default parameters is generated. See the optimset reference page for details.

New Calling Sequences

Version 5 of MATLAB makes these changes in the calling sequences:

The sections below describe how to convert from the old function names and calling sequences to the new ones. The calls shown are the most general cases, involving all possible input and output arguments. Note that many of these arguments are optional. See the function reference pages for more information.

Converting from fmin to fminbnd.   In Version 4, you used this call to fmin.

In Version 5, you call fminbnd like this.

Converting from fmins to fminsearch.   In Version 4, you used this call to fmins.

In Version 5, you call fminsearch like this.

Converting to the new form of fzero.   In Version 4, you used this call to fzero.

In Version 5, replace the TRACE and TOL arguments with

Now call fzero like this.

Converting from nnls to lsqnonneg.   In Version 4, you used this call to nnls.

In Version 5, replace the tol argument with

Now call lsqnonneg like this.


  Troubleshooting Numerical Integration (Quadrature)