The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1,675
Registered: 11/8/10
Re: Surface Fitting Equation
Posted: Oct 18, 2013 2:41 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Chee" wrote in message <l3omd1$bf1$>...
> 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
and follow the link to "Overdetermined Systems".

Best wishes

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.