Owning Class: polynomials
Requires: MathScript RT Module
[pieces, order] = poly_pw(breaks, coefs)
Legacy Name: mkpp
Constructs a piecewise polynomial.
| Name | Description |
|---|---|
| breaks | Specifies the points at which the piecewise polynomial breaks. breaks is a vector. |
| coefs | Specifies the coefficients of the piecewise polynomial. coefs is a matrix. The size of coefs must equal the length of breaks. |
| Name | Description |
|---|---|
| pieces | Returns the number of pieces of the polynomial. pieces is a scalar. |
| order | Returns the polynomial order. order is a scalar. |
P = [2, 1, 0, 3; 1, -8, 0, 1];
[PIECE, ORDER] = poly_pw([0, 1, 2], P);
X = -1:0.01:1;
plot(X, polyval(P(1, :), X), X, polyval(P(2, :), X))
[PIECES, ORDER] = poly_pw([1, 2, 3], rand(2, 4))