.
In this segment, we're going to talk about the
direct method
of interpolation,
and we'll focus our attention on linear interpolation.
.
So what interpolation is all about is that if somebody gives you, now, a
value of the function at certain points.|So let's suppose somebody gives you the value of the
function at x0, y0, maybe at another point, and it's x1, y1,
another point, x2, y2, and so on and so forth,
then what you can do is you can draw a curve through all the data points.|So you're drawing a
curve which goes through the data points which are given to you, or the ones which you select
for it to go through, and whatever that curve is, so let's suppose this is some
fn of x, depending on if you have, let's suppose, n-plus-1 data points.
So whatever curve that is, for example, is called the
interpolant, so this is called the interpolant.
So in order to be able to find the value of x at . . .
or y at some other point, you just choose the value of x, and you get the corresponding
value of y from the interpolant itself.|So that's
what interpolation is all about.|So what we're going to do is we're going to focus our attention
in this segment on linear interpolation, and see that how that allows us to find the value of the function
at some point which is not given to us.|So let's go ahead and see what linear
interpolation is all about.
So in linear interpolation,
so we will choose two data points.
So let's suppose we have x0, y0 here, and x1, y1.
Now, keep in mind that you could have several points being given to you, you might have a hundred points
given to you, or a million points given to you.|So what you have to do is that you have to see that
at what point is the person interested in finding out the value of y.|So if that
point is right here, then you've got to choose the points which are closest to that,
closest to this particular point which bracket the root itself . . . bracket
the point itself, at which you are trying to find out what the value of the function is, and
those are the two points which you're going to choose.|So please keep in mind that when somebody's giving you many, many,
many data points, that doesn't necessarily mean that you have to use all of them.|So if you're using linear interpolation,
you just choose the points which are closest to the point, but of
course it has to bracket that point also.|So this is the line which you'll be
drawing through, which will be a straight line, and this straight line will be of the
form, let's suppose, a0, plus a1 x.
Now, what you have to do is you have to find what a0 and a1 are from these two values which are given to you,
and then you can find the value of the y from this particular
straight line for any value of x.|The best thing to do is to choose a . . .
choose an example, and that way we'll be able to figure out
how to do this linear interpolation.|So let's
suppose we take this example here, we are given velocity as a function of
We are given velocity as a function of time, time is given in seconds,
velocity is given in meters per second.|So this is given as 0,
0, 10, 227.04,
15, 362.78,
at 20 it's 517.35, at 22.5
it's 602.97, and at
30 it's 901.67.|So let's suppose somebody
gives you these values, and he says, hey, go ahead and find out what the value of the velocity at
16 is.|So keep in mind that here
what we are given is . . . given our six data points, and what we want to do
is we want to find out what the value of the velocity is at 16 seconds, and if we are using
linear interpolation, that means that we just need to use these two points, 15 and 20,
because these are the points which are closest to 16, because this is 1 away from 16, this
is 4 away from 16, and at the same time, these two points, these two data points, so
these two values of t, or time, they do bracket this point at 16, so
that's how the choice of the data points has to be made.|So, what that means is that I'm
going to choose v of t to be equal to a0, plus a1 t,
that's the form of the straight line which I'm going to choose, and I'm going to say
hey, v of 15, which is given to me as 362.78, is equal
to a0, plus a1 times 15, because that's the value of the velocity
at time equal to 15.|Now, I'm also given the value of the velocity at
20, which is 517.35, that's a0,
plus a1 times 20.|So what you are seeing
here is by substituting the values of the velocity at 15 and 20, what you are
getting is two equations, two unknowns.|So these are, this is one equation and
this is the second equation there.|So based on that, what I can do is I can write
this in the matrix form, which is a good idea, because then you can get some practice on you numerical methods of
simultaneous linear equations.|So I know that the unknowns are a0 and a1, so that goes
in the solution vector, or the unknown vector as you may call it, and the coefficient of a0 is
1 and 15, that's what you get from here, it's 1 and 15, the coefficient of
a0 is 1 here, the a1 is 20, so it's 1 and 20, the right-hand side value is
362.78 . . . 362.78, and then this one is
517.35.|You can solve these
two equations and two unknowns by any method you want to.|I would suggest you use
the Gaussian elimination method, and once you do that, I'm not going to show you the steps of that,
but I will just give you what the solution is, a0 turns out to be -100.93,
and a1 turns out to be 30.914.
So that's what you get from the solution of those two equations.
So what that means is that the velocity, the linear interpolant velocity,
or the interpolant for the velocity, is given as a0,
plus a1 t, and this will be -100.93,
plus 30.914 times t,
and also that this interpolant is valid between 15 and 20.|So whenever you are
showing interpolants for interpolation, it is very important for you to show, not just the
interpolant itself, but also the domain in which that particular interpolant is
valid.|Otherwise you might start putting values of time, or t in this
case, to be outside this range, which then is not interpolation, but it would be considered to be
extrapolation.|So the value of the velocity at 16 is
-100.93 times 16, plus 30.914 . . .
sorry, this is -100.93, plus
30.914 times 16 here, and this value here turns out to be
393.7 meters per second.|So that's
what you get as the value of the velocity at 16 by using linear interpolation
between this point and this point.|So you have the value of the velocity
at 15, you have the value of the velocity at 20, you do the linear interpolation between
those two points, you are able to find out what the unknowns of that linear interpolant are,
be able to write down the expression of the interpolant, and then you are able to find out what the
velocity at 16 is.|And that's the end of this segment.
.