Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University 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 ]
Torsten

Posts: 1,477
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$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.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.