function polyfit2derr

Returns a 2D N-th order polynomial fit to X. X must be 2-dimensional. The function returns a vector of size sum(i+1)*2 (for i=0 to N). The fittet polynomial has the following form:
   for N=3: f(x,y) = a0 + a1*x + a2*y + a3*x^2 + a4*x*y + a5*y^2 + a6*x^3 + a7*x^2*y + a8*x*y^2 + a9*y^3 The values a0, ..., a9 are returned in the first 10 elements of the returned vector, their respective errors in the elements 11...20.

result = polyfit2d(X, N, ERROR [, CHISQ])

X:   A vector.
N:   An integer number.
ERROR:   The error of the X-values. If this is a real number, all X-values are assumed to have the same error. If ERROR is a vector, it must have the same length as X and gives the error or each individual X value.
CHISQ:   If set to a named variable, the variable is overwritten with the chi-squared of the fit.

See also
function polyfit
function polyfitxy
function polyfitxyerr
function polyfit2derr