MATLAB Function Reference Previous page   Next Page
ppval

Evaluate piecewise polynomial.

Syntax

Description

v = ppval(pp,xx) returns the value of the piecewise polynomial f, contained in pp, at the entries of xx. You can construct pp using the functions pchip, spline, or the spline utility mkpp.

v is obtained by replacing each entry of xx by the value of f there. If f is scalar-valued, v is of the same size as xx. If f is [d1,..,dr]-valued and xx has size [n1,...,ns], then v has size [d1,...,dr, n1,...,ns]. v(:,...,:, j1,...,js) is equal to the value of f at xx(j1,...,js), with the following exceptions:

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

mkpp, spline, unmkpp


Previous page  power prefdir Next page

© 1994-2005 The MathWorks, Inc.