This is machine translation

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

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


Evaluate piecewise polynomial


v = ppval(pp,xx)


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. xx may be N-dimensional.

If pp was constructed by pchip, spline, or mkpp using the orientation of non-scalar function values specified for those functions, then:

If f is [D1,..,Dr]-valued, and xx is a vector of length N, then V has size [D1,...,Dr, N], with V(:,...,:,J) the value of f at xx(J).

If f is [D1,..,Dr]-valued, and xx has size [N1,...,Ns], then V has size [D1,...,Dr, N1,...,Ns], with V(:,...,:, J1,...,Js) the value of f at xx(J1,...,Js).


Compare the result of integrating cos(x) between 0 and 10 to the result of integrating a piece-wise polynomial approximation of the same function.

a = 0; b = 10;
int1 = integral(@cos,a,b)

int1 =

Create a piece-wise polynomial approximation of cos(x) and integrate over the same interval.

x = a:b; 
y = cos(x);
pp = spline(x,y);
int2 = integral(@(x)ppval(pp,x),a,b)

int2 =

See Also

| |

Introduced before R2006a

Was this topic helpful?