Linear interpolation between two known points
Given
the
two
red
points,
the
blue
line
is
the
linear
interpolant
between
the
points,
and
the
value
y
at
x
may
be
found
by
linear
interpolation.
If
the
two
known
points
are
given
by
the
coordinates
and
,
the
linear
interpolant
is
the
straight
line
between
these
points.
For
a
value
x
in
the
interval
,
the
value
y
along
the
straight
line
is
given
from
the
equation
which
can
be
derived
geometrically
from
the
figure
on
the
right.
It
is
a
special
case
of
polynomial
interpolation
with
n
=
1.
Solving
this
equation
for
y,
which
is
the
unknown
value
at
x,
gives
which
is
the
formula
for
linear
interpolation
in
the
interval
.
Outside
this
interval,
the
formula
is
identical
to
linear
extrapolation.
This
formula
can
also
be
understood
as
a
weighted
average.
The
weights
are
inversely
related
to
the
distance
from
the
end
points
to
the
unknown
point;
the
closer
point
has
more
influence
than
the
farther
point.
Thus,
the
weights
are
and
,
which
are
normalized
distances
between
the
unknown
point
and
each
of
the
end
points.
Linear extrapolation A
sound
choice
of
which
extrapolation
method
to
apply
relies
on
a
prior
knowledge
of
the
process
that
created
the
existing
data
points.
Crucial
questions
are
for
example
if
the
data
can
be
assumed
to
be
continuous,
smooth,
possibly
periodic
etc.
Extrapolation
means
creating
a
tangent
line
at
the
end
of
the
known
data
and
extending
it
beyond
as
that
limit.
Linear
extrapolation
will
only
provide
good
results
when
used
to
extend
the
graph
of
an
approximately
linear
function
or
not
too
far
beyond
the
known
data.
If
the
two
data
points
nearest
the
point
x *
to
be
extrapolated
are
(xk 1,yk 1)
and
(xk,yk),
linear
extrapolation
gives
the
function:
(which
is
identical
to
linear
interpolation
if
xk
1
<
x
*
<
xk).
It
is
possible
to
include
more
than
two
points,
and
averaging
the
slope
of
the
linear
interpolant,
by
regression-like
techniques,
on
the
data
points
chosen
to
be
included.
This
is
similar
to
linear
prediction.
SEE
ALSO
[Link]
[Link]