jhpro.interpolator
Class ConstrainedSplineInterpolator
- java.lang.Object
-
- jhpro.interpolator.ConstrainedSplineInterpolator
-
- All Implemented Interfaces:
- UnivariateInterpolator
public class ConstrainedSplineInterpolator extends java.lang.Object implements UnivariateInterpolator
Constrained Spline Interpolation algorithm (CJC Kruger). If we want to avoid overshoot for an arbitrary function, we should find some other interpolation algorithm. One of the methods is called Constrained Cubic Spline Interpolation. It was proposed by CJC Kruger in his article: http://www.korf.co.uk/spline.pdf The algorithms is based on a classic cubic spline algorithm. The key step in it is the calculation of the slope (first derivative) at each point. Intuitively, the slope will be between the slopes of the adjacent straight lines (can be a mean value of the two slopes), but it also should approach zero if the slope of either line approaches zero.import android.util.Spline; float x[] = ... float y[[] = ... Spline f = Spline.createMonotoneCubicSpline(x, y); // this will evaluate y0 = f(x0) float y0 = f.interpolate(x0);
Created by Anton Danshin on 24/12/14.
-
-
Constructor Summary
Constructors Constructor and Description ConstrainedSplineInterpolator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PolynomialSplineFunctioninterpolate(double[] x, double[] y)Compute an interpolating function for the dataset.
-
-
-
Method Detail
-
interpolate
public PolynomialSplineFunction interpolate(double[] x, double[] y) throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException
Description copied from interface:UnivariateInterpolatorCompute an interpolating function for the dataset.- Specified by:
interpolatein interfaceUnivariateInterpolator- Parameters:
x- Arguments for the interpolation points.y- Values for the interpolation points.- Returns:
- a function which interpolates the dataset.
- Throws:
DimensionMismatchException- if arrays lengthes do not matchNumberIsTooSmallExceptionNonMonotonicSequenceException
-
-
DMelt 3.0 © DataMelt by jWork.ORG