Daniel@0: function y = rosen(x) Daniel@0: %ROSEN Calculate Rosenbrock's function. Daniel@0: % Daniel@0: % Description Daniel@0: % Y = ROSEN(X) computes the value of Rosenbrock's function at each row Daniel@0: % of X, which should have two columns. Daniel@0: % Daniel@0: % See also Daniel@0: % DEMOPT1, ROSEGRAD Daniel@0: % Daniel@0: Daniel@0: % Copyright (c) Ian T Nabney (1996-2001) Daniel@0: Daniel@0: % Calculate value of Rosenbrock's function: x should be nrows by 2 columns Daniel@0: Daniel@0: y = 100 * ((x(:,2) - x(:,1).^2).^2) + (1.0 - x(:,1)).^2;