fminbnd
and fmincon
are both optimization functions in Matlab, but they are used to handle different types of optimization problems.
fminbnd
is used for solving problems with a single variable, where the input function is univariate. It can search for the minimum of a function within a specified interval.
On the other hand, fmincon
is used for solving optimization problems with multiple variables, where the input function is multivariate. This function can handle both constrained and unconstrained optimization problems where the constraints can be linear or nonlinear.
Here is a simple example of using fminbnd
for univariate optimization:
main.m144 chars6 lines
Here is a simple example of using fmincon
for multivariate optimization:
main.m311 chars14 lines
In summary, if you are trying to minimize a function of a single variable, use fminbnd
. If you are trying to minimize a function of multiple variables subject to constraints, use fmincon
.
gistlibby LogSnag