polyint
Polynomial integration
Description
Examples
Integrate Quartic Polynomial
Evaluate the definite integral
Create a vector to represent the polynomial integrand . The 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
.
q = polyint(p)
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
Integrate Product of Two Polynomials
Evaluate
Create vectors to represent the polynomials and .
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 = 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.
a = 0; b = 2; I = diff(polyval(q,[a b]))
I = 32.6667
Input Arguments
p
— Polynomial coefficients
vector
Polynomial coefficients, specified as a vector. For example,
the vector [1 0 1]
represents the polynomial ,
and the vector [3.13 -2.21 5.99]
represents the
polynomial .
For more information, see Create and Evaluate Polynomials.
Data Types: single
| double
Complex Number Support: Yes
k
— Constant of integration
numeric scalar
Constant of integration, specified as a numeric scalar.
Example: polyint([1 0 0],3)
Data Types: single
| double
Complex Number Support: Yes
Output Arguments
q
— Integrated polynomial coefficients
row vector
Integrated polynomial coefficients, returned as a row vector. For more information, see Create and Evaluate Polynomials.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
The polyint
function
fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray
(Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)