Transcription of Quadratic Spline Example
1 InterpolationReading Between the LinesWHATISINTERPOLATION?Given (x0,y0), (x1,y1), .. (xn,yn), find the value of y at a value of x that is not Interpolation of discrete ://nm mathforcollege comAPPLIED PROBLEMSThe upward velocity of a rocket is given as a function of time in table below. Find the velocity and acceleration at t=16 Velocity as a function of vs. time data for the rocket Example ,s ,m/sFLYROCKETFLY, FLYROCKETFLYTHERMISTORCALIBRATIONT hermistors are based on change in resistance of a material with temperature. A manufacturer of thermistors makes the following observations on a thermistor. Determine the calibration curve for ( )T( C) curve needs to be fit through the given points to fabricate the ProfilePointx (in.)y (in.) Method of Spline Interpolation?Runge s Function ( ) =11 + 25 2 + Function & InterpolantMore is Better ( ) =11 + 25 2 Comparing Function & InterpolantAnswer to the Problem is Spline InterpolationWolfram DemonstrationA Wolfram Demonstration: : Chris MaesWith Permission from Wolfram Research14 Linear Spline InterpolationG ive n () ()()()nnnnyxyxyxyx.
2 ,,,,111100 , fit linea r sp lines to the da ta. This s imp ly invo lves forming the consecutive data through straight lines. So if the above data is given in an ascending order, the linear splines are given by ())(iixfy= Fig u re : L i ne ar s pli ne s 15 Linear Spline Interpolation (contd)),()()()()(001010xxxxxfxfxfxf += 10xxx ),()()()(112121xxxxxfxfxf += 21xxx .. ),()()()(1111 +=nnnnnnxxxxxfxfxf nnxxx 1 Note the terms of 11)()( iiiixxxfxf in the above function are simp ly slopes between 1 ix and ix. 16 ExampleThe upward velocity of a rocket is given as a function of time in Table 1. Find the velocity at t=16 seconds using linear Velocity as a function of timeFigure. Velocity vs. time data for the rocket Example (s)(m/s) ( )17 Linear Spline Interpolation,150=t )(0=tv ,201=t )(1=tv )()()()()(001010tttttvtvtvtv += )15( +=t )15( )( +=ttv At ,16=t )1516( )16( +=v m/s 18 Quadratic Spline InterpolationG ive n () ()() ()nnnnyxyxyxyx.
3 ,,,,111100 , fit Quadratic splines through the data. The splines are give n b y ,)(1121cxbxaxf++= 10xxx ,2222cxbxa++= 21xxx .. ,2nnncxbxa++= nnxxx 1 Find ,ia,ib,ic=i1, 2, .., n 19 Quadratic Spline Interpolation (contd)Each Quadratic Spline goes through two consecutive data points )(0101201xfcxbxa=++ )(1111211xfcxbxa=++ .. )(1121 =++iiiiiixfcxbxa )(2iiiiiixfcxbxa=++ .. )(1121 =++nnnnnnxfcxbxa )(2nnnnnnxfcxbxa=++ T his co nd it io n give s 2 n eq uat io ns 20 Quadratic Spline Interpolation (contd)The firs t derivatives o f two q uad ratic sp lines a re co ntinuo us a t the inte rior po ints. For Example , the derivative o f the firs t sp line 1121cxbxa++ is 112bxa+ The derivative of the second Spline 2222cxbxa++ is 222bxa+ and t he t wo are equal at 1xx= giving 21211122bxabxa+=+ 022212111= +bxabxa 21 Quadratic Spline Interpolation (contd)Similarly at the other interior points, 022323222= +bxabxa .. 02211= +++iiiiiibxabxa.
4 0221111= + nnnnnnbxabxa We have (n-1) such equations. The total number of equations is )13()1()2( = +nnn. We can assume that the first Spline is linear, that is 01=a 22 Quadratic Spline Interpolation (contd)This gives us 3n equations and 3n unknowns. Once we find the 3n constants, we can find the function at any value of x using the splines, ,)(1121cxbxaxf++= 10xxx ,2222cxbxa++= 21xxx .. ,2nnncxbxa++= nnxxx 1 Quadratic Spline ExampleThe upward velocity of a rocket is given as a function of time. Using Quadratic splinesa) Find the velocity at t=16 secondsb) Find the acceleration at t=16 secondsc) Find the distance covered between t=11 and t=16 secondstv(t) and Plottv(t) ( ) = 1 2+ 1 + 1,0 10= 2 2+ 2 + 2,10 15= 3 2+ 3 + 3,15 20= 4 2+ 4 + 4,20 22 .5= 5 2+ 5 + 5,22 .5 30 Let us set up the equationsEach Spline Goes Through Two Consecutive Data Points ( ) = 1 2+ 1 + 1,0 10 1(0)2+ 1(0) + 1= 0 1(10 )2+ 1(10 ) + 1= 227.
5 04tv(t) SplineGoes Through Two Consecutive Data Points 2(10 )2+ 2(10 ) + 2= 227 .04 2(15 )2+ 2(15 ) + 2= 362 .78 3(15 )2+ 3(15 ) + 3= 362 .78 3(20 )2+ 3(20 ) + 3= 517 .35 5(30 )2+ 5(30 ) + 5= 901 .67 4(20 )2+ 4(20 ) + 4= 517 .35 4(22 .5)2+ 4(22 .5) + 4= 602 .97 5(22 .5)2+ 5(22 .5) + 5= 602 .97 Derivatives are Continuous at Interior Data Points ( ) = 1 2+ 1 + 1, 0 10= 2 2+ 2 + 2,10 15 1 2+ 1 + 1 =10= 2 2+ 2 + 2 =10 2 1 + 1 =10= 2 2 + 2 =102 110 + 1= 2 210 + 220 1+ 1 20 2 2= 0 Derivatives are continuous at Interior Data Points2 1(10 ) + 1 2 2(10 ) 2= 02 2(15 ) + 2 2 3(15 ) 3= 02 3(20 ) + 3 2 4(20 ) 4= 02 4(22 .5) + 4 2 5(22 .5) 5= 0At t=10At t=15At t=20At t= Equation 1= 0 Final Set of Equations00 1 00 0 00 000 000 010010 1 00 0 00 000 000 000 0 10010 1 00 000 000 000 0 22515 1 00 000 000 000 0 00 0 22515 100 000 000 0 00 0 40020 100 000 000 0 00 0 00 0 40020100 000 0 00 0 00 0 22.
6 5 100 000 0 00 0 00 000 0 100 0 00 0 00 000 0 900301201 0 20 1 0 00 000 000 000 0 301 0 30 1 000 000 000 0 00 0 401 0 40 1 000 000 0 00 0 00 0451 0 45 1 010 0 00 0 00 000 000 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5= of Spline Solution ( ) = 22 .704 ,0 10= 2+ + 88 .88 , 10 15= 2+ 35 .66 141 .61 ,15 20= 2 33 .956 + 554 .55 ,20 22 .5= 2+ 28 .86 152 .13 ,22 .5 30 Velocity at a Particular Pointa) Velocity at t=16 ( ) = 22 .704 ,0 10= 2+ + 88 .88 ,10 15= 2+ 35 .66 141 .61 ,15 20= 2 33 .956 + 554 .55 ,20 22 .5= 2+ 28 .86 152 .13 ,22 .5 30 16 = + 35 .6616 141 .61= 394 .24 m/s ( ) = 22 .704 ,0 10= 2+ + 88 .88 ,10 15= 2+ 35 .66 141 .61 ,15 20= 2 33 .956 + 554 .55 ,20 22 .5= 2+ 28 .86 152 .13 ,22 .5 30 Acceleration from Velocity Profile (16 ) = ( ) =16b) Acceleration at t=16 Acceleration from Velocity ProfileThe Quadratic Spline valid at t=16 is given by ( ) = ( 2+ 35.
7 66 141 .61 )= + 35 .66 , 15 20 (16 ) = (16 ) + 35 .66= 31 .321 m/s2, = 2+ 35 .66 141 .61 ,15 20 Distance from Velocity Profilec) Find the distance covered by the rocket from t=11s to t=16s. ( ) = 22 .704 ,0 10= 2+ + 88 .88 ,10 15= 2+ 35 .66 141 .61 ,15 20= 2 33 .956 + 554 .55 ,20 22 .5= 2+ 28 .86 152 .13 ,22 .5 30 16 11 = 1116 ( ) Distance from Velocity Profile = 2+ + 88 .88 ,10 15= 2+ 35 .66 141 .61 ,15 20 16 11 = 1116 ( ) = 1115 ( ) + 1516 ( ) = 1115( 2+ + 88 .88 ) + 1516( 2+ 35 .66 141 .61 ) = a Smooth Shortest Path for a for Robot Path the shortest but smooth path through consecutive data pointsPolynomial Interpolant PathSpline Interpolant PathCompare Spline & Polynomial Interpolant PathLength of pathPolynomial Interpolant= Interpolant =