Fminbnd

From DDL Wiki

Jump to: navigation, search

fminbnd is an optimization function built into Matlab that is used for solving one dimensional, constrained optimizations.

Running an optimization using the fminbnd function requires several steps. First, one needs the function being analyzed, and the optimization constraints. As an example the function f(x) = 3*sin(x)-x/2 will be analyzed over the range of 0<=x<=2.

An M-file must be created to store the function. This file must be saved in the current directory as fx.m. For this example case the M-file will appear as follows:

  function f=fx(x)
  f = 3*sin(x)-x/2


The function must then be implemented. This is done through the following command and output as follows:

>> x=fminbnd(‘fx’,0,8)

Matlab will then output the following:

f = -5.3980

x = 4.8798

In this output, the value of f is the value of the function at the minimum. Likewise, x is the point at which the minimum occurs. This result may be verified by plotting the function. Doing so produces the following plot which appears to match the result by fminbnd:


Image:fminbnd_pic.jpg


Help may be found by using the built in 'help' command in Matlab. Help for fminbnd may be found by typing the following into the command window:

>> help fminbnd

Personal tools