function [ p ] = horner( a, x ) %HORNER horner(a,x) evaluates a(1) + a(2)*x + a(3)*x.^2 + .. + a(n)*x.^(n-1) % Using Horner's method p = zeros(size(x)); for k=1:length(a) p = p.*x + a(k) end end