function TFD = Fdiff(X, Y) %% Input:: % X = [ x0 x1 .. xn ] - object vector % Y = [ y0 y1 .. yn ] - image vector %% Output: % TFD - table of forward differences [p, m ] = size(X); % m points, polynomial order <= m-1 if p ~= 1 || p ~=size(Y, 1) || m ~= size(Y, 2) error('divdiff: input vectors must have the same dimension'); end TFD = zeros(m, m); TFD(:, 1) = Y'; for j = 2 : m for i = 1 : (m - j + 1) TFD(i,j) = (TFD(i + 1, j - 1) - TFD(i, j - 1)); end end end