Code covered by the BSD License  

Highlights from
Files for the 2012 Webinar "Tips and Tricks - Getting Started Using Optimization with MATLAB"

image thumbnail

Files for the 2012 Webinar "Tips and Tricks - Getting Started Using Optimization with MATLAB"

by

 

These are the files that were used for the demonstrations in the webinar.

rosenbrockGrad(x)
function [f,gradf] = rosenbrockGrad(x)
%ROSENBROCKGRAD Rosenbrock's equation with gradient calculation.
%   ROSENBROCKGRAD(X) calculates the value and gradient of Rosenbrock's 
%   equation at X, where X is a vector of length 2.
%
%   Syntax
%      [f, gradf] = rosenbrockGrad(x)

% Copyright (c) 2012, The MathWorks, Inc.
% All rights reserved.

f = (1-x(1))^2 + 100*(x(2)-x(1)^2)^2;

gradf = [2*x(1)-2 + 100*(4*x(1)^3-4*x(1)*x(2)); 
         100*(2*x(2)-2*x(1)^2)];
      

Contact us