Polynomial integration
q = polyint(p,k)
q = polyint(p)
example
q = polyint(p,k) returns the integral of the polynomial represented by the coefficients in p using a constant of integration k.
q
p
k
q = polyint(p) assumes a constant of integration k = 0.
k = 0
collapse all
Evaluate the definite integral
I=∫-13(3x4-4x2+10x-25)dx.
Create a vector to represent the polynomial integrand 3x4-4x2+10x-25. The x3 term is absent and thus has a coefficient of 0.
p = [3 0 -4 10 -25];
Use polyint to integrate the polynomial using a constant of integration equal to 0.
polyint
0
q = 1×6 0.6000 0 -1.3333 5.0000 -25.0000 0
Find the value of the integral by evaluating q at the limits of integration.
a = -1; b = 3; I = diff(polyval(q,[a b]))
I = 49.0667
Evaluate
I=∫02(x5-x3+1)(x2+1)dx
Create vectors to represent the polynomials p(x)=x5-x3+1 and v(x)=x2+1.
p = [1 0 -1 0 0 1]; v = [1 0 1];
Multiply the polynomials and integrate the resulting expression using a constant of integration k = 3.
k = 3
k = 3; q = polyint(conv(p,v),k)
q = 1×9 0.1250 0 0 0 -0.2500 0.3333 0 1.0000 3.0000
Find the value of I by evaluating q at the limits of integration.
I
a = 0; b = 2; I = diff(polyval(q,[a b]))
I = 32.6667
Polynomial coefficients, specified as a vector. For example, the vector [1 0 1] represents the polynomial x2+1, and the vector [3.13 -2.21 5.99] represents the polynomial 3.13x2−2.21x+5.99.
[1 0 1]
[3.13 -2.21 5.99]
For more information, see Create and Evaluate Polynomials.
Data Types: single | double Complex Number Support: Yes
single
double
Constant of integration, specified as a numeric scalar.
Example: polyint([1 0 0],3)
polyint([1 0 0],3)
Integrated polynomial coefficients, returned as a row vector. For more information, see Create and Evaluate Polynomials.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
polyder | polyfit | polyval | polyvalm
polyder
polyfit
polyval
polyvalm
You have a modified version of this example. Do you want to open this example with your edits?