21 Aug 2007 KKKQ 3013 PENGIRAAN BERANGKA Week 7 – Interpolation & Curve Fitting 21 August am – 9.00 am
21 Aug 2007 Week 7 Page 2 Topics Introduction Newton Interpolation: Finite Divided Difference Lagrange Interpolation Spline Interpolation Polynomial Regression Multivariable Interpolation
21 Aug 2007 Week 7 Page 3 Tutorial Example 1 (adapted courtesy of ref. [1]) Dynamic viscosity of water (10 -3 N.s/m 2 ) is related to temperature T( o C) in the following manner: [1] Chapra, S.C & Canale, R.P, Numerical Methods for Engineers, McGraw-Hill 5th ed. (2006) a)Estimate at T = 7.5 o C using cubic spline interpolation b)Use polynomial regression to determine a best fit parabola of the above data. In addition, determine the corresponding standard deviation. Based on this parabola, what is at T = 7.5 o C ?
21 Aug 2007 Week 7 Page 4 Tutorial Example 1
21 Aug 2007 Week 7 Page 5 Tutorial Example 1
21 Aug 2007 Week 7 Page 6 Tutorial Example 1
21 Aug 2007 Week 7 Page 7 Tutorial Example 1
21 Aug 2007 Week 7 Page 8 Tutorial Example 1
21 Aug 2007 Week 7 Page 9 Tutorial Example 1
21 Aug 2007 Week 7 Page 10 Tutorial Example 1 (using MATLAB) >> x=[ ] x = >> y=[ ] y = >> a=interp1(x,y,7.5,'spline') a = >> p=polyfit(x,y,2) p = >> b=polyval(p,7.5) b = Prediction using cubic spline interpolation Coefficient for best fit quadratic equation i.e. a 2, a 1 and a 0 in descending powers of x