.
I'm going to take an example
of quadratic spline interpolation.|We have already gone through the theory.
So the example which we're going to take is that of a rocket
which is going up as a function of time.|So in the table you are given the
velocity as a function of time at 0, 10, 15, 20, 22.5, and
30 seconds, and what you are asked to do is to use quadratic
splines, and but you are asked to do three things.|You are asked to not only find the velocity
a point which is not given to you.|So as you can see there that the value of the velocity is
not given at 16, so you're asked to find the value of the velocity at 16 seconds, but also there are other parts
to the problem.|You're asked to find the acceleration at t equal to 16 seconds, which will involve some kind of a
differentiation of the velocity expression, and then the distance covered between two
times, t equal to 11 and t equal to 16, which again, will involve
some integration of the velocity expression.|So let's go ahead and see how
that is done.|Now, here is
the . . . here are the data which I just showed you for velocity versus function of time.|I'm just showing
you the plot here for the velocity as a function of time.
So you're going to basically what you're going to do is you're going to draw a quadratic spline from 0
to 10, then another quadratic spline from 10 to 15, then another
from 15 to 20, then the next one from 20 to 22.5, and
the next one from 22.5 to 30.|So you will have
one quadratic spline here, then the second quadratic spline here,
then the third quadratic spline here, then the fourth one right here, and
the fifth one right here.|So you can see that you'll have five quadratic splines which will go through
these six consecutive data points.
So these are the five . . . five consecutive quadratic splines
splines which we are talking about.|Each spline will be a quadratic equation, so you've
got to understand that we have three unknowns in each spline.|So let's suppose the first
spline is going from point 0 to 10, and it has three unknowns, a1,
b1, c1.|So similarly, the next spline has three
unknowns, and so on and so forth.|So you are, what you are finding out is that you
have fifteen unknowns.|You have fifteen unknowns, because you have five
splines going through the six consecutive data points, and each spline has three unknowns,
ai, bi, and ci, so you have fifteen unknowns, so you've got to somehow set up
fifteen equations to be able to solve fifteen equations and fifteen unknowns.
So let's go ahead and set up these fifteen equations and fifteen unknowns, and see
how where we get those from.|Now, the first thing which you have to realize is that each spline will
go through two consecutive data points.|What do we mean by that?|It is as follows, that if I
look at the first spline right here, that's my first spline, and that is this particular spline right
here.|So if I look at the first spline, I have three unknowns, a1, b1,
c1.|I cannot find all three unknowns by simply saying that this spline
goes through point t equal to 0 and t equal to 10, because that will only
set up two equations, but it is a start here that the first spline is
going through the points 0 and 10, so points 0 and 10, the first spline
is going through it.|So this equation which you are seeing here is the equation
for the spline going through time, t equal to 0, and this equation which you are seeing here is
for the same spline going through time, t equal to 10.|So since we have
two equations coming from each spline going through two consecutive data points,
and since we have five splines, we will get ten equations like that.
The reason why we get ten equations is because we have five splines, and each spline is going through two consecutive data
points, setting up two equations just like this one and this one, and hence
it will result in ten equations.|So let's go ahead and see what those ten equations are.|These are the ten equations
which you are getting.|So this is . . . these two equations are coming from that the second
spline is going through 10 and 15 . . .
10 and 15.|Then let's look at the next spline.
Next spline is saying that, hey, you have these two equations,
and these two equations are coming from that the third spline is going through
time, t equal to 15 and 20 data points, so that will give you two more equations.
And then we have the next
two, which are these two equations right here.|Those are coming from
this data point and this data point, because you can very well see that time,
t equal to 20 and 22.5 have been substituted into that
spline.|That gives you two more equations.|And then we're left with
the last two data points, and that is that, hey, these two equations
which you have from the fifth spline are obtained from that the spline is
going through time, t equal to 22.5 and 30.|So that . . . this
whole thing is setting up ten equations.
So we have ten equations, as we
said that we have to set up fifteen equations, fifteen unknowns.|So we already have set up ten equations
by saying that the . . . each spline is going through consecutive data points.|Now,
the other equations which you're going to set up is by saying that the derivatives are continuous at the
interior data points.|So what that means is that if you look at the first spline, and you
take that, its derivative, and you look at the second spline,
and you take its derivative, that derivative has to be same at the common point,
which is 10 there.|So that's what we are showing right here, that we are going to take the derivative of
the first spline, we're going to take the derivative of the second spline.|Keep in mind
that the two derivatives are not same everywhere, they're only same at the common point,
which is t equal to 10, which ensures that the slope of the two splines is same
through the . . . through the data points.|So when I take the derivative, I get this
for the first spline, I get this for the second spline, and then I'll have to substitute the value of t equal
to 10, because that's where the splines are the same.|So
this is what I get as my final equation.|Now I take everything which is on the right-hand side
to the left-hand side.|The reason why that is so is because every time you write an equation, you always take the unknowns
the left-hand side, and since a2 and b2 are unknowns, we need to take
them to the left-hand side.|So this sets up one equation at time, t equal to 10.
Now, similarly you'll see that, hey, you will have other equations,
you'll have the equation at time, t equal to 15, time, t equal to 20, and
time, t equal to 22.5, you will get similar equations, that the derivatives are
continuous of the consecutive splines.|So you have four equations
coming from here, so you've got four equations coming from the fact that your
derivative is continuous at the interior data points.|You're only able to set up four equations, although you have six
data points, but you're only able to set up four equations, because there are only four interior data
points.|The other two data points, t equal to 0 and t equal to 30, t
equal to 0 and 30, they are external
data points, and we cannot say that the first derivative is continuous at t equal to 0 and 30,
because we don't have adjoining . . . we don't have a spline . . . we don't have two
splines going through those two data points.|So what
we have now is that we needed fifteen equations, we needed fifteen equations,
we got ten equations from saying that, hey, each spline is going through consecutive data points,
we got four equations saying that each spline has
continuous first derivative at the interior data points, so we end up with fourteen equations.
So since we have fourteen equations now, we need one more equation, because
we needed fifteen, because we have fifteen unknowns, so the last equation which comes from is the fact that
we're going to assume a1 equal to 0.|a1 equal to 0 simply means that
you are assuming that the first spline is linear, because your spline is like this, a1
t squared, plus b1 t, plus c1.|So if you're going to assume
a1 equal to 0, you're only left with these terms, which means that you're assuming that the first spline is
linear, and you have to do something like that, because you need fifteen equations, fifteen unknowns,
and you're not violating anything by saying that the last equation a1 is equal to 0, you still have your
splines going through consecutive data points, you still have the first slop same at the interior data
points.|So this is what you get
as the resulting equations once you take the fifteen equations, fifteen unknowns.|This might not
be visible to you when you are seeing this, but I just wanted to put it up there.|You can look at this in the
PowerPoint presentation.|So let me just skip through this,
and then what we do is we solve those fifteen equations, fifteen unknowns, and these are the
resulting unknowns, so we have ais in the first column, bis in the second column, cis
in the third column.|So these are the unknowns which we get.|So, for example, if you're going to look at
this particular i equal to 2, that is your second spline, so the second spline will be
0.888 t squared,
so that is this number, plus 4.928
t, that is this number here, then plus 88.88,
and this is the second spline, which is going . . . which is
going through the points 10 and
15.|So similarly, you can set up the other splines by
looking at what the coefficients are.|And that's the end
of this segment, and in the next segment, I will show you how we are using this information
to be able to get the values which we are looking for.
.