%% Find Minimum Location and Value
% Find both the location and value of a minimum of an objective function using fminsearch.
% Write an anonymous objective function for a three-variable problem.

x0 = [1,2,3];
fun = @(x)-norm(x+x0)^2*exp(-norm(x-x0)^2 + sum(x));

%
% Find the minimum of fun starting at x0. Find the value of the minimum as well.

[x,fval] = fminsearch(fun,x0)

% Copyright 2012 The MathWorks, Inc.