function y = horners(x,coefs,c)
%  This function uses Horner's method to evaluate
%  a given polynomial centered at c, whose coefficients are stored
%  in the vector coefs, going from lowest to highest
%  Usage:
%       y = horners(x,coefs,c)

if nargin < 3
  c = 0
end

counter = max(size(coefs));
y = coefs(counter);
while (counter>1)
  counter = counter - 1;
  y = y .* (x-c) + coefs(counter);
end
