Torsten
Posts:
1,627
Registered:
11/8/10


Re: Surface Fitting Equation
Posted:
Oct 18, 2013 2:41 AM


"Chee" wrote in message <l3omd1$bf1$1@newscl01ah.mathworks.com>... > Hi everyone, > > I'm doing surface fitting in MATLAB. The thing that I'm curious is about how the coefficients are calculated. I'm using 'poly22' fitting, and below is the equation of the fitting: > > zVal = p00 + p10 .* x + p01 .* y + p20 .* x.^2 + p11 .* x .* y + p02 .* y.^2; > > What sort of equation does MATLAB use to calculate p00,p10,p20,p11,p02 ? Even a simple surface fitting algorithm that shows how the coefficient is helpful, so that I can understand how the coefficients are calculated. > > Thank you.
If (x(i),y(i),zval(i)) are your measurement points, the coefficients are determined by minimizing the function F(p00,p10,p01,p20,p11,p02) = sum_i (zVal(i)(p00 + p10*x(i) + p01*y(i) + p20*x(i)^2 + p11*x(i)*y(i) + p02*y(i)^2))^2 with respect to p00,p10,p01,p20,p11,p02. This can be done by solving the overdetermined system of equations p00 + p10*x(i) + p01*y(i) + p20*x(i)^2 + p11*x(i)*y(i) + p02*y(i)^2 = zVal(i) in the leastsquares sense using the backslash operator (\). Take a look at http://www.mathworks.de/de/help/matlab/math/systemsoflinearequations.html and follow the link to "Overdetermined Systems".
Best wishes Torsten.

