newpoly - D(:,1)=Y'; % Divided difference table for j=2:n...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [C,D]=newpoly(X,Y) %Input - X is a vector that contains a list of abscissas % - Y is a vector that contains a list of ordinates %Output - C is the a vector that contains the coefficients of % the Newton interpolatory polynomial % - D is the divided difference table - n=length(X); D=zeros(n,n);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: D(:,1)=Y'; % Divided difference table for j=2:n for k=j:n D(k,j)=(D(k,j-1)-D(k-1,j-1))/(X(k)-X(k-j+1)); end end %Determine the coefficients of the Newton interpolating polynomial C=D(n,n); for k=(n-1):-1:1 C=conv(C,poly(X(k))); m=length(C); C(m)=C(m)+D(k,k); end...
View Full Document

This note was uploaded on 09/11/2011 for the course MECH 231 taught by Professor Den during the Spring '11 term at Rutgers.

Ask a homework question - tutors are online