フィルターのクリア

Integrating from polyint(p)

3 ビュー (過去 30 日間)
Tatte Berklee
Tatte Berklee 2020 年 8 月 3 日
コメント済み: Tatte Berklee 2020 年 8 月 4 日
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?

採用された回答

John D'Errico
John D'Errico 2020 年 8 月 4 日
編集済み: John D'Errico 2020 年 8 月 4 日
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 件のコメント
Tatte Berklee
Tatte Berklee 2020 年 8 月 4 日
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?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by