There are different optimization methods available in Matlab to find the minimum of a function. Here is an example with the fminsearch function:
main.m320 chars13 lines
In this example, we define the function f(x,y) as the sum of two squared terms. We then use the fminsearch function to find the minimum of f starting from the initial guess x0. The output of fminsearch contains the optimal solution (xopt) and the minimum value (fval) of the function.
gistlibby LogSnag