pp = pgfplot_cs(matrix [ , type, derived ] ); pp = pgfplot_cs(x, y [ , type, derived ] );
The pgfplot_cs() function constructs a cubic spline for given points and returns a piecewise polynomial (pp) structure.
The matrix argument contains point data, one point per
line. For each point we have x and y value (columns 1
and 2). The third column -- if present -- contains values for the
first derivative dy/dx at the points. If you don't
specify values for all points, use NA for the points where
dy/dx is not known.
Instead of specifying dy/dx in the third column, you can specify dy/dx in the derived argument. This column vector must have the same length as the number of rows in the matrix.
The column vectors x and y can be used instead of the matrix to specify coordinates. The vectors must have equal lengths.
The type argument specifies the spline type.
|The default spline type. The third derivative is contiguous in the second and penultimate point.|
|Natural spline. The second derivative is 0 in the first and last point.|
|periodic||The first and second derivative of the last interval in the last point are equal to the first interval in the first point.|
|fast||The spline is constructed without solving a linear system of equations. Quadratic polynomials are calculated for each triplet of contiguous points. For the middle point the first derivative of the polynomial is used as the first derivative of the spline. The first and last polynomial is used for the first and last point. The time required for the calculation increases only linearly with the number of points.|
|fast-periodic||Combination of fast and periodic.|