newpolyuse - p4(x)=p3(x)+D(5,5)*(x-1)*(x-2)*(x-3)*(x-4)...

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

View Full Document Right Arrow Icon
%function y=3.6/x x=[1,2,3,4,5]; y=[3.6,1.8,1.2,.9,.72]; %%using newpoly! %%D=divided diff table %%C=newton polynomial!! %%5 data points gives a 4th degree polynomial p1(x)=D(1,1)+D(2,2)*(x-1) p2(x)=p1(x)+D(3,3)*(x-1)*(x-2) p3(x)=p2(x)+D(4,4)*(x-1)*(x-2)*(x-3)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: p4(x)=p3(x)+D(5,5)*(x-1)*(x-2)*(x-3)*(x-4) %%evaluate newton polynomial p4(x) at x=2.5 polyval(C,2.5) %%plot the actual function and newton poly obtained x1=linspace(.5,5.5); y1=3.6./x1; ynew=polyval(C,x1); plot(x1,y1,'--',x1,ynew) p...
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