CHAPTER 05.05: SPLINE METHOD: Linear Spline Interpolation: Example
In this segment, we're going to talk about an example for linear spline interpolation. So we're going to take an example and see that how linear spline interpolation works on data which is given to us. So let's suppose somebody gives us the time versus velocity data for a rocket, and this is how the data is given to us, that at 0 it is 0, at 10 it is 227.04, at 20 it is 517.35, at 15 it is 362.78, at 22.5 it is 602.97. So let's suppose somebody gives us these five data points and says, hey, go ahead and find out what the value of the velocity at 16 is by using linear spline interpolation. Can you give me what the value of the velocity at 16 is by using linear spline interpolation on the data which is given to you here? Now, the first thing which you've got to realize is that the time data, which is here, or the velocity versus time data, the time data is not in ascending or descending order, because you've got 0, 10, 20, and then you've got 15, and then you've got 22.5. So what you have to do is we have to rewrite this particular data. So I'm going to rewrite this particular data here. So time, velocity, seconds, meters per second. So the only part which I have to rewrite is because I will switch 15 to 20, and that's all I have to do, switch this data . . . data pair with this data pair, and I will have it in ascending order. So I'm going to write it down here, 0, 0, 10, 227.04, then 15, 362.78, then 20, 517.35, and 22.5 is 602.97. So what I have done is just switched this 15 and 20 data pair, this data pair and this data pair, and now you find out that time is in ascending order. So now I can do my spline interpolation, linear spline interpolation, because I want to find out what the value of the velocity at 16 is. So if I want to find the value of the velocity at 16, I'm going to use these two data points, because those are the ones which bracket the value at 16. So what that means is that . . . that my velocity expression for the spline will be equal to whatever is the velocity at 15, plus the velocity at 20 minus the velocity at 15, divided by 20 minus 15, times t minus 15. So that's the equation of a straight line, which will be the equation of the linear spline which is going to go through those two data points. So v of 15 is how much? 362.78, plus v of 20 is 517.35, velocity at 15 is 362.78, divided by 20 minus 15, times t minus 15. So this turns out to be equal to 362.78, plus 30.913 times t minus 15, and the expression, of course, is valid between 15 and 20. Again, even . . . again, with linear splines also, you've got to find out what the interpolant is, which in this case is this, but you also need to show what the domain in which that interpolant is valid, in this case being 15 to 20. Now, since the value of 16 is between 15 and 20, I can use that to find out the velocity at 16. So the velocity at 16 is approximately equal to 362.78, plus 30.913 times 16 minus 15, and that value here turns out to be 393.7 meters per second. So that's how you are able to use your linear spline interpolation to be able to find the velocity, in this case, at any point you want to. Keep in mind that linear spline interpolation is just like linear interpolation by any other method, whether you're using direct method, Newton's divided difference method, Lagrange interpolation method, it is exactly the same, the only thing is when you are writing linear splines, you write linear splines for all the data which is given to you, and then you pick and choose based on where the point is which you are using for your linear spline interpolation. So here, we directly chose the point between 15 and 20, we did not write down the other expressions for the linear splines, and we use that to find out the velocity at 16. And that's the end of this segment.