How do I numerical integrate polynomial coefficients to a high order?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello,
I have the coefficients of a polynomial of order 12 given to me using polyfit (it was fitted to model a probability density function). I now need to use the given polynomial f(x), multiply it by x^2, and integrate it over a given boundary.
I have tried using the integral function: integral(fun,xmin,xmax), where: fun = @(x) poly2sym(f) and f is the coefficients given by polyfit, but this doesn't work.
Any ideas? Apologies if this seems trivial, I have tried everything!
Thanks in advance, Rajin
댓글 수: 0
채택된 답변
Mike Hosea
2013년 12월 16일
편집: Mike Hosea
2013년 12월 16일
Suppose p is a polynomial in MATLAB (a vector of coefficients). Multiplying by x^2 and integrating could be done by
Q = integral(@(x)polyval([p,0,0],x),xmin,xmax)
But how about
pint = polyint([p,0,0]);
Q = polyval(pint,xmax) - polyval(pint,xmin);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!