mkpp
Builds a piecewise polynomial structure.
Category: Mathematics > Interpolation
Syntax
pp = mkpp(breaks, coefs)
Creates the structure from the break points and one row of coefficients per interval.
pp = mkpp(breaks, coefs, d)
Creates a vector-valued piecewise polynomial with values of size d.
Description
Each row of coefs holds the polynomial for one interval, written in powers of the offset from the left break point: the row [a b c] on the interval starting at t means a*(x-t)^2 + b*(x-t) + c.
The structure is what spline, pchip and makima return when called without query points. Evaluate it with ppval and take it apart with unmkpp.
Input arguments
breaks- Vector of
L+1increasing break points that defineLintervals. coefs- Coefficients, one row per interval, highest power first, in the local variable
x - breaks(i). d- Optional size of the value at each point, for vector-valued functions.
Output arguments
pp- Structure with fields
form,breaks,coefs,pieces,orderanddim.
Example
Two quadratic pieces
pp = mkpp([0 1 2], [1 0 0; 2 1 0]);
ppval(pp, [0.5 1.5])
pp.order
Output
ans = 1×2
0.2500 1.0000
ans = 3