Documentation

This is machine translation

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

polyint

Polynomial integration

Syntax

Description

example

q = polyint(p,k) returns the integral of the polynomial represented by the coefficients in p using a constant of integration k.

example

q = polyint(p) assumes a constant of integration k = 0.

Examples

collapse all

Evaluate

$$I = \int_{-1}^{3} \left( 3x^4 - 4x^2 +10x -25 \right) dx$$

Create a vector to represent the polynomial $3x^4 - 4x^2 +10x -25$.

p = [3 0 -4 10 -25];

Use polyint to integrate the polynomial using a constant of integration equal to 0.

q = polyint(p)
q =

    0.6000         0   -1.3333    5.0000  -25.0000         0

Find the value of the integral, I, by evaluating q at the limits of integration.

a = -1;
b = 3;
I = diff(polyval(q,[a b]))
I =

   49.0667

Evaluate

$$I = \int_0^2 \left(x^5-x^3+1\right) \left(x^2+1\right) dx$$

Create vectors to represent the polynomials $p(x)=x^5-x^3+1$ and $v(x)=x^2+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;
q = polyint(conv(p,v),k)
q =

  Columns 1 through 7

    0.1250         0         0         0   -0.2500    0.3333         0

  Columns 8 through 9

    1.0000    3.0000

Find the value of I by evaluating q at the limits of integration.

a = 0;
b = 2;
I = diff(polyval(q,[a b]))
I =

   32.6667

Related Examples

Input Arguments

collapse all

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.13x22.21x+5.99.

For more information, see Create and Evaluate Polynomials.

Data Types: single | double
Complex Number Support: Yes

Constant of integration, specified as a numeric scalar.

Example: polyint([1 0 0],3)

Data Types: single | double
Complex Number Support: Yes

Output Arguments

collapse all

Integrated polynomial coefficients, returned as a row vector. For more information, see Create and Evaluate Polynomials.

Introduced before R2006a

Was this topic helpful?