Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [wynik] = rzedy(x,y)
- n=length(x);
- R=zeros(n);
- R(:,1)=y;
- for i=1:n-1
- for j=1:n-i
- R(j,i+1)=(R(j+1,i)-R(j,i))/(x(i+j)-x(j));
- end
- end
- wynik = R;
- function[wynik] = newton(R,X,Y)
- R=rzedy(x,y);
- syms x;
- n=length(X);
- W=Y(1);
- for i=1:n-1
- a=1;
- for j=1:i
- a=a*(x-X(j));
- end
- W=W+(R(1,i+1)*a)
- end
- wynik = simplify(W);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement