Rank: 244857 based on 0 downloads (last 30 days) and 0 file submitted
photo

Eran

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Eran View all
Updated File Comments Rating
27 Oct 2013 polyfitn Polynomial modeling in 1 or n dimensions Author: John D'Errico

Hi again,

Thank you so much for your last answer!
Of course it was a dumb question :)

I have another question, that might be a bit more tricky -
lets say that I have a set of n points.
I want to check what is the polynomial fit for every k<n (of course k is big enough to hold enough data for the fit). meaning I want to have (almost) n polynomials fitings.
of course I can do a "for" loop and get my answer... But that is very inefficient.

Is there any way to modify your code slighlty so that this would work?

I think that the main problem is in the part where you define the "design matrix".

Thanks again for the quick help!

23 Oct 2013 polyfitn Polynomial modeling in 1 or n dimensions Author: John D'Errico

Hi Jhon,

Tahnks you very much for this so-needed function. It's a shame that matlab doesn't support this...

I tried using this function, and encountered a small problem.
I used:
x=0:100;
y=x/2;
z=4+x+x.^2+x.y;
in=[x' y'];

out=polyfitn(in,z,2);

and what I get is a warnning about the singularety of the matrix "R" produced by the function "qr". That of course when I use "\" that practicly uses the inverse of "R".
This happans twice in the lines after using the function "qr".

Do you have any advise on how to solve this?

I'm asking this question of course, becuase I get that the coeficients produced by "polyfitn" are very different from those you would expect...

Thanks you very much!

Contact us