function SX=rosenbrock(x)

if size(x,2)==1
    error('The dimension of a random sample needs to be greater than 1.')
end

SX=zeros(size(x,1),size(x,2));
for i=1:size(x,2)-1
    SX(:,i)=mod(i,2)*100.*(x(:,i+1)-x(:,i).^2).^2+(1-x(:,i)).^2;
end
SX=sum(SX,2); 
