﻿function Q = DannyNewtonInterp(x,y)
    n=length(x);
    for i=1:n
        Q(i,1)=y(i);
        %makes a matrix out of the y values of the function, making it vertical instead of the default imput of horizontal, will eventually be filled in to become the final answer
    end%for

    for j=2:n
        for i=1:n-j+1
            %Similar to nevviles, this uses the other values to compute the next "a" in the series, iterativly using the last values to make the next set, each including 1 less value than the last set, making a pyramid, the top row of those values are our coefficients of the newtons interpolator
            
            Q(i,j)=((Q(i,j-1)-Q(i+1,j-1))/(x(i)-x(i+j-1)));
        end%for
    end%for
    
end%function
