************80
! INTERP_LINEAR applies piecewise linear interpolation to data.
Discussion:
From a space of DIM_NUM dimensions, we are given a sequence of
DATA_NUM points, which are presumed to be successive samples
from a curve of points P.
We are also given a parameterization of this data, that is,
an associated sequence of DATA_NUM values of a variable T.
The values of T are assumed to be strictly increasing.
Thus, we have a sequence of values P(T), where T is a scalar,
and each value of P is of dimension DIM_NUM.
We are then given INTERP_NUM values of T, for which values P
are to be produced, by linear interpolation of the data we are given.
Note that the user may request extrapolation. This occurs whenever
a T_INTERP value is less than the minimum T_DATA or greater than the
maximum T_DATA. In that case, linear extrapolation is used.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
03 December 2007
Author:
John Burkardt
Parameters:
Input, integer ( kind = 4 ) DIM_NUM, the spatial dimension.
Input, integer ( kind = 4 ) DATA_NUM, the number of data points.
Input, real ( kind = 8 ) T_DATA(DATA_NUM), the value of the
independent variable at the sample points. The values of T_DATA
must be strictly increasing.
Input, real ( kind = 8 ) P_DATA(DIM_NUM,DATA_NUM), the value of the
dependent variables at the sample points.
Input, integer ( kind = 4 ) INTERP_NUM, the number of points
at which interpolation is to be done.
Input, real ( kind = 8 ) T_INTERP(INTERP_NUM), the value of the
independent variable at the interpolation points.
Output, real ( kind = 8 ) P_INTERP(DIM_NUM,DATA_NUM), the interpolated
values of the dependent variables at the interpolation points.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=4) | :: | dim_num | ||||
integer(kind=4) | :: | data_num | ||||
real(kind=8) | :: | t_data(data_num) | ||||
real(kind=8) | :: | p_data(dim_num,data_num) | ||||
integer(kind=4) | :: | interp_num | ||||
real(kind=8) | :: | t_interp(interp_num) | ||||
real(kind=8) | :: | p_interp(dim_num,interp_num) |