polyfit2b
Polynomial fit in 2 dimensions
Contents
Syntax
[p, S] = polyfit2b(x,y,z,n,m)
Description
Compute the polynomial coefficients of a function of 2 variables x and y of degrees n and m, respectively, that fit the data in z in a robust least-squares sense, using bisquare weights on residuals. x,y and z can be vectors or matrices of the same size. S is a structure containing three elements: the Cholesky factor of the Vandermonde matrix, the degrees of freedom and the norm of the residuals.
if n = 3 and m = 1, the coefficents of the output p matrix are arranged as shown:
p31 p30 p21 p20 p11 p10 p01 p00
The indices on the elements of p correspond to the order of x and y associated with that element.
For a solution to exist, the number of ordered triples [x,y,z] must equal or exceed (n+1)*(m+1). Note that m or n may be zero.
To evaluate the resulting polynominal function, use polyval2D.