Clicky

Fortran Wiki
interpolation (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #0 to #1: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

PCHIP method

Below is a function that interpolates an array using a Piecewise Cubic Hermitian Interpolator. The required external methods are provided by the PCHIP module.

 function interpolate(x, y, p) result(r)
 !! This function constructs a piecewise cubic Hermitian interpolation of an array y(x) based on discrete numerical data,
 !! and evaluates the interpolation at points p. Note that the mesh spacing of x does not necessarily have to be uniform.
 real(wp), intent(in) :: x(:) !! Variable x
 real(wp), intent(in) :: y(size(x)) !! Function y(x)
 real(wp), intent(in) :: p(:) !! Interpolation domain p
 real(wp) :: r(size(p)) !! Interpolation result y(p)
 real(wp) :: d(size(x))
 integer :: err
 ! Create a PCHIP interpolation of the input data
 call dpchez(size(x), x, y, d, .false., 0, 0, err)
 ! Extract the interpolated data at provided points
 call dpchfe(size(x), x, y, d, 1, .false., size(p), p, r, err)
 end function
Created on April 22, 2016 17:47:00 by jabirali (46.9.153.214) (1265 characters / 0.0 pages)
Edit | Views: Print | TeX | Source | Linked from: Code

AltStyle によって変換されたページ (->オリジナル) /