function y = polyval_fast(p,x)
%% y = polyval_fast(p,x)
% Evaluate n'th degree polynomial to x,y data without any condition checks.

x = x(:);
n = numel(p)-1;

% Construct Vandermonde matrix
V(:,n+1) = ones(length(x),1,class(x));
for j = n:-1:1
   V(:,j) = x.*V(:,j+1);
end

y = p*V'; % Evaluate polynomial
end