function tbl = Dif(y) % usage: DividDif(y) % description: for input vector y of ordinates of function f(x) % returns a zero padded matrix whose ith row is the ith diagonal % of a difference table for the data. n = length(y); y = y(:); % make y column tbl = zeros(n,n); tbl(:,1) = y(:); for k = (2:n) tbl(1:n-k+1,k) = (tbl(2:n-k+2,k-1)-tbl(1:n-k+1,k-1)); end;