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 ]
 Curious Posts: 2,359 Registered: 12/6/04
Re: Numerical integration of polyfit coefficients
Posted: Dec 12, 2013 1:52 PM

"Rajin " <patelr37@aston.ac.uk> wrote in message <l8ctcd\$jrp\$1@newscl01ah.mathworks.com>...
> 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

The obvious first question is: "What do you mean by doesn't work?"
Any error message? Or just "looks" wrong.

It is not suprising you might get a non-sensical answer by trying to
integrate a 12 order polynomial. Try a different fitting function.

Look at the MathWorks curve fitting toolbox or try ezyfit from the MATLAB FEX:

<<http://www.mathworks.com/matlabcentral/fileexchange/10176-ezyfit-2-41>>

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