Files
School/Anul 3/Semestrul 2/Calcul numeric/divdiff.m
T
2025-07-03 20:56:38 +03:00

12 lines
201 B
Matlab

function t = divdiff(x, f)
n = length(x);
t=zeros(n);
t(:,1)= f'
for j = 2:n
t(1:n-j+1,j) = (t(2:n-j+2,j-1) - t(1:n-j+1,j-1))./((x(j:n)-x(1:n-j+1))');
endfor
end