% Example of use of the function FMINUNC applied to the % objective function f, that is Rosenbrock's: % % f = 100*(x(2) - x(1)^2)^2 + (1-x(1))^2 % % fminunc finds a local minimum of a function of several variables. % X = fminunc(FUN,X0) starts at X0 and attempts to find a local minimizer % X of the function FUN. FUN accepts input X and returns a scalar % function value F evaluated at X. X0 can be a scalar, vector or matrix. x0 = [-4,8]; fun = @(x)100*(x(2) - x(1)^2)^2 + (1-x(1))^2; [x,fval] = fminunc(fun,x0) return