Integrating from polyint(p)

8 visualizaciones (últimos 30 días)
Tatte Berklee
Tatte Berklee el 3 de Ag. de 2020
Comentada: Tatte Berklee el 4 de Ag. de 2020
Hi folks!
I have a question regarding univariate integration from the coefficients produced (e.g. 1x8 double) from polynomial integration.
An example code I have is:
[p,S] = polyfit(x,y,N);
q=polyint(p);
At this point, the code produces something like 1x8 double with polynomial coefficients.
But the ultimate integral I would like to compute is an indefinite integral with lower and upper limit being 1 and inf respectively in the form of a fraction:
x/(the polynomial I got for q with x being the variable).
How would I do this?

Respuesta aceptada

John D'Errico
John D'Errico el 4 de Ag. de 2020
Editada: John D'Errico el 4 de Ag. de 2020
Sorry, but polyint cannot integrate a rational polynomial, and certainly not over an infinite region. Depending on the roots of the polynomial, it may or may not have an integral.
The simplest way to do your integration is to use the symbolic toolbox.
syms x
P = x^4 + 8*x^3 + 23*x^2 + 28*x + 12;
int(x/P,x,[1,inf])
ans =
log((3*2^(1/2))/8) + 2/3
If you have only the coefficients of the polynomial, you can still do it.
pcoeff = [1 8 23 28 12];
roots(pcoeff)
ans =
-3
-2
-2
-1
So a happy list of roots.
int(x/poly2sym(pcoeff,x),[1,inf])
ans =
log((3*2^(1/2))/8) + 2/3
  1 comentario
Tatte Berklee
Tatte Berklee el 4 de Ag. de 2020
John, thank you. Since I know exactly to which order my polynomial goes, I did something like: (e.g. n=6)
fun = @(x) x/(p(1,1)*x.^6+p(1,2)*x.^5+p(1,3)*x.^4+p(1,4)*x.^3+p(1,5)*x.^2+p(1,6)*x+p(1,7)).^2;
exp = integral(fun,0,Inf,'ArrayValued',true);
Does my code look valid?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by