# Documentation

### This is machine translation

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

# unmkpp

Extract piecewise polynomial details

## Syntax

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

## Description

example

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

## Examples

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`.

```subplot(2,2,1) cc = [-1/4 1 0]; pp1 = mkpp([-8 -4],cc); xx1 = -8:0.1:-4; plot(xx1,ppval(pp1,xx1),'k-') subplot(2,2,2) pp2 = mkpp([-4 0],-cc); xx2 = -4:0.1:0; plot(xx2,ppval(pp2,xx2),'k-') subplot(2,1,2) pp = mkpp([-8 -4 0 4 8],[cc;-cc;cc;-cc]); xx = -8:0.1:8; plot(xx,ppval(pp,xx),'k-') [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 plot(xx,ppval(dpp,xx),'r-') 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`