function [a] = polyinterp(x,y)

% This function interpolates the dataset [x,y]
% by using a polynomial of order n where n+1 
% is the length of x and y.
%
% Input x -> column vector of nodes 
%       y -> column vector of data points at locations x
%
%
% Output a -> Coefficients of the interpolating polynomial
%             a(1)+a(2)x+ a(3)x^2 + .....+ a(n+1)x^n


n = length(x)-1; % this is the polynomial order

V = x.^0;

for ii=1:n
    V = [V x.^ii];
end

[a] = BS(V,y);
% a=V \ y;
end

