MATLAB Function Reference |

Evaluate piecewise polynomial.

**Syntax**

**Description**

```
v = ppval(pp,xx)
```

returns the value at the points `xx`

of the piecewise polynomial contained in `pp`

, as constructed by `spline`

or the spline utility `mkpp`

.

```
v = ppval(xx,pp)
```

returns the same result but can be used with functions like `fminbnd`

, `fzero`

and `quad`

that take a function as an argument.

**Examples**

Compare the results of integrating the function `cos`

with the results of integrating the piecewise polynomial `pp`

that approximates the cosine function by interpolating the computed values `x`

and `y`

.

`int1`

provides the integral of the cosine function over the interval `[a,b]`

, while `int2`

provides the integral over the same interval of the piecewise polynomial `pp`

.

**See Also**

pow2 | prefdir |