Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function NB = newton_backward(x, y, a)
- n = length(x);
- diff_table = zeros(n, n);
- for i = 1 : n
- diff_table(i, 1) = y(i);
- end
- for j = 2 : n
- for i = 1 : n - j + 1
- diff_table(i, j) = diff_table(i + 1, j - 1) - diff_table(i, j - 1);
- end
- end
- NB = diff_table(n, 1);
- s = (a - x(n)) / (x(2) - x(1));
- fact = 1;
- val = s;
- for j = 2 : n
- NB = NB + (val * diff_table(n - j + 1, j)) / fact;
- val = val * (s + j - 1);
- fact = fact * j;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement