You are here: Symbol Reference > Polynoms Namespace > Functions > Polynoms.Linear1D Function
MtxVec VCL
ContentsIndex
Example
uses MtxExpr, Math387, MtxVec, MtxVecEdit, MtxVecTee,Polynoms; procedure TForm1.Button1Click(Sender: TObject); var X,Y,Y2: Vector; PP : TPiecePoly; i : Integer; YVal : double; begin PP := TPiecePoly.Create; try // generate function - note that X values are monotonical X := Ramp(100,0,1); Y := RandUniform(100,0,50) + Ramp(100,100,0.25); // construct cubic splines, but do not evaluate them Linear1D(X,Y,PP); X := Ramp(800,0,0.125); //get interpolation points PP.Evaluate(X,Y2); // evaluate DrawIt(Y,'Original'); DrawIt(Y2,'Interpolated'); finally PP.Free; end; end;
#include "MtxExpr.hpp" #include "Polynoms.hpp" #include "MtxVecTee.hpp" #include "MtxVecEdit.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { sVector X,Y,Y2; TPiecePoly *PP; int i; double YVal; PP = new TPiecePoly(); try { // 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 Linear1D(X,Y,PP); X.Size(800); X.Ramp(0,0.125); //get interpolation points PP->Evaluate(X,Y2); // evaluate DrawIt(Y,"Original",false); DrawIt(Y2,"Interpolated",false); } __finally { delete PP; } }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.