|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peakml.math.function.CubicSplineFunction
public class CubicSplineFunction
This class calculates the natural cubic spline for a given set of input values. In
mathematics a spline is a special function defined piecewise by polynomials
(see PolynomialFunction
). The approach attempts to solve the following equation
by using row operations to convert the matrix to upper triangular and then back
substitution. The D[i] are the derivatives at the knots.
gamma D delta [2 1 ] [D[0]] [3(x[1] - x[0]) ] |1 4 1 | |D[1]| |3(x[2] - x[0]) | | 1 4 1 | | . | = | . | | ... | | . | | . | | 1 4 1| | . | |3(x[n] - x[n-2])| [ 1 2] [D[n]] [3(x[n] - x[n-1])]
http://en.wikipedia.org/wiki/Cubic_spline
http://www.cse.unsw.edu.au/~lambert/splines/source.html
Constructor Summary | |
---|---|
CubicSplineFunction(double[] xvals,
double[] yvals)
Constructs (i.e. |
Method Summary | |
---|---|
static CubicSplineFunction |
fit(double[] xvals,
double[] yvals)
Constructs (i.e. |
double |
getY(double x)
Calculates the y-value for the given x-value with the function defined here. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CubicSplineFunction(double[] xvals, double[] yvals)
xvals
- The x-values.yvals
- The y-values.Method Detail |
---|
public double getY(double x)
Function
getY
in interface Function
x
- The x-value.
public static CubicSplineFunction fit(double[] xvals, double[] yvals)
xvals
- The x-values.yvals
- The y-values.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |