This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSci 5302 HW3 v.2 Due: 23 Mar 2010 Do this assignment in pairs (groups of two students). Hand in only one copy for each pair, with both names on it. This question should be done by a Matlab function to interpolate an arbitrary set of points, which you should hand in. You will need it in a later question. 1. Interpolate a polynomial through the following set of points: x 2 1 1 2 y 1 4 1 . Use any general method for computing an interpolating polynomial, but explain the method you used, showing the intermediate numerical results. Even if you can guess the answer without computing anything, you must still use a general method for computing the interpolating poly nomial. However, you can do this question by hand or by a mix of hand and computer, using the computer as a glorified calculator. This question is to be done with the simple matlab script as indicated. 2. Fit a natural cubic spline through the set of points of question 1. Use the Matlab function natspline to do it. You can find this in the Handouts section of the class web site: http:// wwwusers.itlabs.umn.edu/classes/Spring2010/csci5302/Handouts/natsplineOnCampus. htm . Try the Matlab commands x = 2:2; y = [0 1 4 1 0]; xx = 2:0.1:2; p = ... polynomial coefficients computed using function from question 1 yyp = polyval(p,xx); % to evaluate the polynomial at all the points xx pp = natspline(x,y); % to compute the natural cubic spline pp.coefs % to print out the coefficients of the spline yys = ppval(pp,xx); % to evaluate the spline at many intermediate points plot(xx,yyp,b,xx,yys,r,x,y,ko);...
View Full
Document
 Spring '08
 Boley,D
 Algorithms

Click to edit the document details