function polyfitxyerr

Return an n-th order polynomial fit to the vectors X and Y, where y = f(x). The typical error of the dependent variables is given in ERROR. If a variable is given as the 4th argument, it will be overwritten with the chi squared of the fit.

result = polyfitxyerr(X, Y, N, ERROR [, CHISQ])

X:   A vector.
Y:   A vector.
N:   An integer number.
ERROR:   The error of the Y-values. If this is a real number, all Y-values are assumed to have the same error. If ERROR is a vector, it must have the same length as X and Y and gives the error or each individual Y 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 polyfit2d
function polyfit2derr