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.
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...

Henry:
I have converted column 1 and 2, the deg2utm works perfectly fine. The lat/longs are from UTM zone 16 to zone 14 (from top to bottom). Note that easting suddenly increases as you move from a higher UTM zone number to lower one. There is not much change in Lats so that zone northing remains from letter Q. Column 3 and 4 has wrong transformed values.

Comment only

06 Feb 2014

deg2utm
Function to convert lat/lon vectors into UTM coordinates (WGS84)

Comment only