function [j1,grad] = rosenbrock(x,cof)
%  This is a modification of Erkki Heikkola's func2d.m
%  TK 11.11.02
%
j1 = cof * (x(2) - x(1)^2)^2 + (1 - x(1))^2;
n = size(x);
grad = zeros(n);
grad(1) = -4 * cof * x(1) * (x(2) - x(1)^2) - 2 * (1 - x(1));
grad(2) = 2 * cof * (x(2) - x(1)^2);
