Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Surface Fitting Equation
Replies: 7   Last Post: Oct 22, 2013 9:54 AM

 Messages: [ Previous | Next ]
 Torsten Posts: 1,717 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 least-squares sense using the backslash operator (\).
Take a look at
http://www.mathworks.de/de/help/matlab/math/systems-of-linear-equations.html
and follow the link to "Overdetermined Systems".

Best wishes
Torsten.

Date Subject Author
10/17/13 Chee
10/18/13 Torsten
10/21/13 Chee
10/21/13 John D'Errico
10/22/13 Bruno Luong
10/22/13 Torsten
10/22/13 Chee
10/22/13 dpb