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

Oops, I got it to work - - just my newness to the software.
Forgot to specify the outputs I wanted.
For people like me (getting into matlab), make sure to put your outputs you want in the command window.
IE: [x,y,utmzone] = deg2utm(Lat,Lon), where if you want x, y, and the utmzone you have to tell matlab that. Else it will only give you x (which is what I was getting before hand).
EDU>> [x,y,utmzone] = deg2utm(38.130587, -99.081752)
x = 4.9284e+05
y = 4.2203e+06
utmzone = 14 S

Comment only

07 Jul 2014

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

Hi.
i am unsure if this is a issue or not.
if i input the following:
[x,y]=deg2utm([5153.7870,5153.7870],[00425.8690,00425.8685])
i expect that the x output is the samme for both cordinates, and that i have a diferense of only 0.58m in the y, how ever the diference in x is about 1M and in y about 22,5M. any thoughts ?

Comment only

18 Feb 2014

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

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