CLASS Spline (Defined in: jpgraph_regstat.php : 18)

Spline
Get() Spline()

Class usage and Overview
Utility class to help construct an interpolated data points given an arbitrary number of data points.

This class doesn't draw any graphs by itself it is only used to generate a new set of data points representing the smooth line from the input which are the control lines for the cubic spline.

The principle of using this class is that you first create an instance of this class and giving it the X,Y values for your control points.

You can then get back an interpolated smooth dataset by calling the Get() method. This method takeas as argument how many data points you want the interpolated graph to have.

Technical note: The spline is constructed with natural 2:nd derivates at the start and end points of the line.

Class Methods

function Get($num)
// Return the two new data vectors

Argument | Default | Description
--- | --- | ---
$num | 50 | Number of data points

Description
Return a data set representing the interpolated smooth curve passing through all the specified control points.

Example

$spline = new Spline($xcontrol_points, $ycontrol_points);
list ($xdata, $ydata) = $spline->Get(100);
$lp = new LinePlot($ydata, $xdata);

function Spline($xdata,$ydata)
Constructor. Create a new Spline object

Argument | Default | Description
--- | --- | ---
$xdata |  | Control points. X-coordinates
$ydata |  | Control points. Y-coordinates

Description
Constructor. Create a new Spline object. The spline is determined by it's control points which are given with it's X and Y coordinates as arguments.

Technical note: The spline is constructed with natural 2:nd derivates at the start and end point.

Example

$spline = new Spline($xcontrol_points, $ycontrol_points);
list ($xdata, $ydata) = $spline->Get(100);
$lp = new LinePlot($ydata, $xdata);