You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Dew.Math.Units Namespace > Classes > Polynoms Class > Polynoms Methods > Spline1D Method > Polynoms.Spline1D Method (TVec, TPiecePoly, bool)
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
Polynoms.Spline1D Method (TVec, TPiecePoly, bool)

Interpolates cubic splines between consecutive Y points.

Syntax
C#
Visual Basic
public static void Spline1D(TVec Y, TPiecePoly PiecePoly, bool Knots);

Interpolates cubic splines between consecutive Y points. The assumption is that Y is evaluated at [0,1,2,...] -> X values are [0,1,2,...]. If the Knot parameter is true then the first and the last Y value will be used for the end conditions. In this case Y.Length = X.Length + 2.

using Dew.Math; using Dew.Math.Units; using Dew.Math.Tee; namespace Dew.Examples { private void Example() { Vector X = new Vector(0); Vector Y = new Vector(0); Vector Y2 = new Vector(0); TPiecePoly PP = new TPiecePoly(); int i; double YVal; // generate function - note that X values are monotonical X.Size(100); Y.Size(100); Y2.Size(100); X.Ramp(0,1); Y.RandUniform(0,50); Y2.Ramp(100,0.25); Y += Y2; // construct cubic splines, but do not evaluate them Polynoms.Spline1D(X,Y,PP); X.Size(800); X.Ramp(0,0.125); //get interpolation points PP.Evaluate(X,Y2); // evaluate MtxVecTee.DrawIt(Y,"Original",false); MtxVecTee.DrawIt(Y2,"Interpolated",false); } }
Copyright (c) 1999-2022 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!