LinearSplineCoef Type

Record type that contains the x-knots, intersects (C0) and slopes (C1) of each interval.

Equivalent to interval-wise simple linear regression between any neighbouring pair of data.

Record fields

Record Field Description

C0

Full Usage: C0

Field type: float[]

Zero order spline coefficients (n), corresponding to line intersects

Field type: float[]

C1

Full Usage: C1

Field type: float[]

First order spline coefficients (n), corresponding to line slopes

Field type: float[]

XValues

Full Usage: XValues

Field type: float[]

sample points (n+1), sorted ascending

Field type: float[]

Instance members

Instance member Description

this.Differentiate

Full Usage: this.Differentiate

Returns: LinearSplineCoef Coefficients of the fst derivative of the linear spline

Determines the coefficients of the derivative of the given linear spline.

Returns: LinearSplineCoef

Coefficients of the fst derivative of the linear spline

this.Predict

Full Usage: this.Predict

Returns: float -> float Y value corresponding to the given x value.

Predicts the y value at point x. A straight line is fitted between the neighboring x values given.

X values that don't not lie within the range of the input x values, are predicted using the nearest interpolation line!

Returns: float -> float

Y value corresponding to the given x value.

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;5.;4.;3.;|]
 // some measured feature
 let yData = vector [|1.;5.;4.;13.;17.|]
 
 // get slopes and intersects for interpolating straight lines
 let coefficients = 
     Interpolation.LinearSpline.interpolate xData yData 

 // get y value at 3.4
 coefficients.Predict 3.4

this.getDerivative x

Full Usage: this.getDerivative x

Parameters:
    x : float - x value of which the corresponding y value should be predicted

Returns: float predicted slope of given linear spline at X=x

Calculates slope values at X=x with given linear spline coefficients.

x : float

x value of which the corresponding y value should be predicted

Returns: float

predicted slope of given linear spline at X=x

Static members

Static member Description

LinearSplineCoef.Create(xValues) (c0) (c1)

Full Usage: LinearSplineCoef.Create(xValues) (c0) (c1)

Parameters:
    xValues : float[]
    c0 : float[]
    c1 : float[]

Returns: LinearSplineCoef
xValues : float[]
c0 : float[]
c1 : float[]
Returns: LinearSplineCoef