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".
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.
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...
I found a bug, in this example the first point P95 is mapped correctly to google maps, but EP2 differs about 70 Meters from GPS coordinates in carthesian:
P95 = [15.425789 47.030778];
[P95_Carthesian(1) P95_Carthesian(2)] = deg2utm(P95(2), P95(1));
EP2 = [15.42604688057756 47.03090763127457];
[EP2_Carthesian(1) EP2_Carthesian(2)] = deg2utm(EP2(2), EP2(1));
26 Jan 2011
Function to convert lat/lon vectors into UTM coordinates (WGS84)