Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Numerical integration of polyfit coefficients
Replies: 6   Last Post: Dec 12, 2013 5:50 PM

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: Numerical integration of polyfit coefficients
Posted: Dec 12, 2013 1:57 PM

On 12/12/2013 11:56 AM, Rajin wrote:
> 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!

Well, as another said, using a 12th order polynomial is asking for
trouble although that isn't _necessarily_ the problem.

The one obvious is that a polynomial integral can be computed
analytically from the coefficients by the power rule of integration and
then evaluated as needed.

Whether the result will be other than nonsensical is indeterminate w/o
some way to evaluate the data and the fit thereof.

Again, try something of much lower order polynomial like a cubic spline
or somesuch, or a better functional form.

--

Date Subject Author
12/12/13 Rajin
12/12/13 Curious
12/12/13 dpb
12/12/13 John D'Errico
12/12/13 Derek Goring
12/12/13 John D'Errico
12/12/13 Derek Goring