function f = GriewangkND(X)
% The Griewangk function has a global minimum
% of 0 at the origin, where f(0) = 0.
% Input matrix X can have any size.
% This version is written especially for DE and so
% X is an n by np matrix where
% n is the number of parameters &
% np is the population size.
% x=(-100:0.1:100); plot(x,feval('GriewangkND',x))
% K. Ming Leung, 10/06/03

[n, np] = size(X); % e.g. n=10
f = sum(X.*X,1)/4000 - prod(cos(X./repmat(sqrt((1:n)'),1,np)),1) + 1;