# mkpp

## 语法

``pp = mkpp(breaks,coefs)``
``pp = mkpp(breaks,coefs,d)``

## 说明

``pp = mkpp(breaks,coefs)` 根据其间断数和系数生成分段多项式 `pp`。使用 `ppval` 计算特定点处的分段多项式，或使用 `unmkpp` 提取有关分段多项式的详细信息。`
``pp = mkpp(breaks,coefs,d)` 指定分段多项式为向量值，以使其每个系数的值都是长度为 `d` 的向量。`

## 示例

```breaks = [0 4 10 15]; coefs = [0 1 -1 1 1; 0 0 1 -2 53; -1 6 1 4 77]; pp = mkpp(breaks,coefs)```
```pp = struct with fields: form: 'pp' breaks: [0 4 10 15] coefs: [3x5 double] pieces: 3 order: 5 dim: 1 ```

```xq = 0:0.01:15; plot(xq,ppval(pp,xq)) line([4 4],ylim,'LineStyle','--','Color','k') line([10 10],ylim,'LineStyle','--','Color','k')```

`$1-{\left(\frac{x}{2}-1\right)}^{2}=\frac{-{x}^{2}}{4}+x.$`

```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-') hold on line([-4 -4],ylim,'LineStyle','--') line([0 0],ylim,'LineStyle','--') line([4 4],ylim,'LineStyle','--') hold off```

## 输出参量

`form`

`'pp'`分段多项式

`breaks`

`coefs`

`L`×`k` 矩阵，其中行 `coefs(i,:)` 包含第 i 个区间 `[breaks(i),breaks(i+1)]``k` 次多项式的局部系数

`pieces`

`order`

`dim`

`$f\left(x\right)=a{\left(x-{x}_{1}\right)}^{3}+b{\left(x-{x}_{1}\right)}^{2}+c\left(x-{x}_{1}\right)+d\text{\hspace{0.17em}}.$`