function sum = polyEval(coeff, x)
% polyEval(coeff, x): Evaluate polynomial at x.
% Vector coeff contains the coefficients; coeff(0) is the constant term.

% Written by Paul Chew for CS100M, Feb 2006

sum = 0;
for k = 1:length(coeff)
    sum = sum + coeff(k)*x^(k-1);
end
