function retval = exerfn(x)
% usage:  y = exerfn(x)
% description: Returns value of function
% of Exercise 4.3 of textbook.
% It is *assumed* that length(x) is even!

% no bulletproofing
% for adapting this problem, use c
c = 10;
m = length(x);
retval = sum((1-x(1:2:m-1)).^2 + c*(x(2:2:m)-x(1:2:m-1).^2).^2);
