![]() |
libSUFR
a LIBrary of Some Useful Fortran Routines
|
Procedures to do interpolation (and fitting?) More...
Functions/Subroutines | |
pure real(double) function | linear_interpolation (x1, x2, y1, y2, x) |
Do linear interpolation using the data points x1,x2, and y1,y2 to find the value y corresponding to x. | |
pure real function | linear_interpolation_sp (x1, x2, y1, y2, x) |
Do linear interpolation using the data points x1,x2, and y1,y2 to find the value y corresponding to x, using single-precision variables. | |
real(double) function | linear_interpolate_array (xarr, yarr, xval) |
Do linear interpolation using the data arrays xArr,yArr to find the value y corresponding to x. | |
pure subroutine | perfect_parabolic_fit (x1, x2, x3, y1, y2, y3, a, b, c) |
Fit a parabola perfectly to three sets of data points x1,y1, x2,y2 and x3,y3. | |
pure real(double) function | parabola (x, a, b, c) |
Compute a parabola a*x^2 + b*x + c. | |
pure integer function | locate_value_in_array (xval, xarray) |
Locate the index in a monotonic array, such that a given value lies between array(index) and array(index+1). 0 or nArr+1 is returned if the value lies outside the array. | |
Procedures to do interpolation (and fitting?)
real(double) function sufr_interpolate::linear_interpolate_array | ( | real(double), dimension(:), intent(in) | xarr, |
real(double), dimension(:), intent(in) | yarr, | ||
real(double), intent(in) | xval ) |
Do linear interpolation using the data arrays xArr,yArr to find the value y corresponding to x.
xArr | X-array, sorted to increasing value |
yArr | Y-array |
xVal | X value to find y value for |
linear_interpolate_array | Y value found |
Definition at line 91 of file interpolate.f90.
References sufr_kinds::double, linear_interpolate_array(), linear_interpolation(), locate_value_in_array(), and sufr_system::warn().
Referenced by linear_interpolate_array().
pure real(double) function sufr_interpolate::linear_interpolation | ( | real(double), intent(in) | x1, |
real(double), intent(in) | x2, | ||
real(double), intent(in) | y1, | ||
real(double), intent(in) | y2, | ||
real(double), intent(in) | x ) |
Do linear interpolation using the data points x1,x2, and y1,y2 to find the value y corresponding to x.
x1 | X value 1 |
x2 | X value 2 |
y1 | Y value 1, belonging to x1 |
y2 | Y value 2, belonging to x2 |
x | X value to find y value for |
linear_interpolation | Y value found |
Definition at line 41 of file interpolate.f90.
References sufr_kinds::double, and linear_interpolation().
Referenced by linear_interpolate_array(), linear_interpolation(), and linear_interpolation_sp().
pure real function sufr_interpolate::linear_interpolation_sp | ( | real, intent(in) | x1, |
real, intent(in) | x2, | ||
real, intent(in) | y1, | ||
real, intent(in) | y2, | ||
real, intent(in) | x ) |
Do linear interpolation using the data points x1,x2, and y1,y2 to find the value y corresponding to x, using single-precision variables.
x1 | X value 1 |
x2 | X value 2 |
y1 | Y value 1, belonging to x1 |
y2 | Y value 2, belonging to x2 |
x | X value to find y value for |
linear_interpolation_sp | Y value found |
Definition at line 70 of file interpolate.f90.
References linear_interpolation(), and linear_interpolation_sp().
Referenced by linear_interpolation_sp().
pure integer function sufr_interpolate::locate_value_in_array | ( | real(double), intent(in) | xval, |
real(double), dimension(:), intent(in) | xarray ) |
Locate the index in a monotonic array, such that a given value lies between array(index) and array(index+1). 0 or nArr+1 is returned if the value lies outside the array.
xVal | Value to locate |
xArray | Array to locate value in. xArray must be monotonic, either ascending or descending |
locate_value_in_array | Index such that the value lies between array(index) and array(index+1). |
Definition at line 181 of file interpolate.f90.
References sufr_numerics::deq(), sufr_kinds::double, and locate_value_in_array().
Referenced by linear_interpolate_array(), and locate_value_in_array().
pure real(double) function sufr_interpolate::parabola | ( | real(double), intent(in) | x, |
real(double), intent(in) | a, | ||
real(double), intent(in) | b, | ||
real(double), intent(in) | c ) |
Compute a parabola a*x^2 + b*x + c.
x | X value |
a | Coefficient a in y = a*x^2 +b*x + c |
b | Coefficient b in y = a*x^2 +b*x + c |
c | Coefficient c in y = a*x^2 +b*x + c |
parabola | The value of the parabola at x. |
Definition at line 158 of file interpolate.f90.
References sufr_kinds::double, and parabola().
Referenced by parabola().
pure subroutine sufr_interpolate::perfect_parabolic_fit | ( | real(double), intent(in) | x1, |
real(double), intent(in) | x2, | ||
real(double), intent(in) | x3, | ||
real(double), intent(in) | y1, | ||
real(double), intent(in) | y2, | ||
real(double), intent(in) | y3, | ||
real(double), intent(out) | a, | ||
real(double), intent(out) | b, | ||
real(double), intent(out) | c ) |
Fit a parabola perfectly to three sets of data points x1,y1, x2,y2 and x3,y3.
x1 | X value 1 |
x2 | X value 2 |
x3 | X value 3 |
y1 | Y value 1, belonging to x1 |
y2 | Y value 2, belonging to x2 |
y3 | Y value 3, belonging to x3 |
a | Coefficient a in y = a*x^2 + b*x + c (output) |
b | Coefficient b in y = a*x^2 + b*x + c (output) |
c | Coefficient c in y = a*x^2 + b*x + c (output) |
Definition at line 127 of file interpolate.f90.
References sufr_kinds::double.