function p = HornerShift(a,t,shift)
% Evaluate a polynomial using Horner's method
% Polynomial is assumed to have the form
% a(1) + a(2)*(t-shift) + a(3)*(t-shift)^2 +...+ a(n+1)*(t-shift)^n
% INPUT: a = vector of n+1 coefficients
% t = vector containing arguments of the polynomial
% shift = a constant (scalar) shift in the arguments
% OUTPUT:p = vector containing values of the poly. at those points
% K. Ming Leung, 02/26/03

N=length(a); % N=n+1
p = a(N); one=ones(size(t));
for k=N-1:-1:1
    p = a(k)*one+p.*(t-shift*one);
end