polyint
Integral of a polynomial.
Category: Mathematics > Elementary Math
Syntax
q = polyint(p)
Returns the coefficients of the antiderivative of p with constant term 0.
q = polyint(p, k)
Uses k as the constant of integration.
Description
Each coefficient p(i) of x^m is divided by m+1 and the degree goes up by one. For a definite integral between a and b, evaluate the antiderivative at both ends: diff(polyval(polyint(p), [a b])).
The operation is the inverse of polyder, apart from the constant.
Input arguments
p- Coefficient vector, highest power first.
k- Scalar constant of integration (default
0).
Output arguments
q- Coefficients of the antiderivative, one element longer than
p.
Example
Antiderivative and definite integral
q = polyint([3 2 1])
polyint([3 2 1], 5)
diff(polyval(q, [0 2]))
Output
q = 1×4
1 1 1 0
ans = 1×4
1 1 1 5
ans = 14