function D = divDiff(x, y)
% divDiff: 计算差商表
%
% Input: x, y 为行向量
%
% Output: D 差商表,仅下三角矩阵有效
n = length(x);
if length(y) ~= n
error('x and y are not comparable');
end
D = zeros(n, n);
D(:, 1) = y(:);
for j = 2 : n
for i = j : n
D(i,j) = ( D(i, j-1) - D(i-1, j-1) )/( x(i) - x(i-j+1) );
end
end