This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Extract piecewise polynomial details


[breaks,coefs,L,order,dim] = unmkpp(pp)



[breaks,coefs,L,order,dim] = unmkpp(pp) extracts information from the fields of the piecewise polynomial structure pp.


collapse all

Create a piecewise polynomial structure for the polynomial on the interval [0 3], and then extract the information from the fields of the structure.

pp = mkpp([0 3],[1 1 1])
pp = struct with fields:
      form: 'pp'
    breaks: [0 3]
     coefs: [1 1 1]
    pieces: 1
     order: 3
       dim: 1

[breaks,coefs,L,order,dim] = unmkpp(pp)
breaks = 

     0     3

coefs = 

     1     1     1

L = 1
order = 3
dim = 1

Create two quadratic polynomials, evaluate them at several query points, and plot the results. Then create a single piecewise polynomial with four intervals that alternate between the two quadratic polynomials.

The first two plots show a quadratic polynomial and its negation shifted to the intervals [-8,-4] and [-4,0]. The polynomial is

The last plot shows a piecewise polynomial constructed by alternating these two quadratic pieces over four intervals. It also shows its first derivative, which was constructed after breaking the piecewise polynomial apart using unmkpp.

cc = [-1/4 1 0]; 
pp1 = mkpp([-8 -4],cc);
xx1 = -8:0.1:-4; 

pp2 = mkpp([-4 0],-cc);
xx2 = -4:0.1:0; 

pp = mkpp([-8 -4 0 4 8],[cc;-cc;cc;-cc]);
xx = -8:0.1:8;
[breaks,coefs,l,k,d] = unmkpp(pp);
dpp = mkpp(breaks,repmat(k-1:-1:1,d*l,1).*coefs(:,1:k-1),d);
hold on
hold off

Input Arguments

collapse all

Piecewise polynomial, specified as a structure. You can create pp using spline, pchip, or the spline utility function mkpp.

Output Arguments

collapse all

Break points, returned as a vector of length L+1 with strictly increasing elements that represent the start and end of each of L intervals.

Polynomial coefficients, returned as an L-by-k matrix with each row coefs(i,:) containing the local coefficients of an order k polynomial on the ith interval, [breaks(i),breaks(i+1)].

Number of intervals, returned as a scalar.

Order of polynomials, returned as a scalar.

Dimension of target, returned as a scalar or vector. dim

Extended Capabilities

See Also

| | |

Introduced before R2006a

Was this topic helpful?