- #1
daviddoria
- 97
- 0
I have a set of points and I want to find a "best fit quardric surface" through the points. I did the following:
1) Assume the function is in the form:
[tex]a x^2 + b y^2 + c xy + d x + e y + f = z[/tex]
2) Make a nx6 matrix of the points put into (1), that is A=:
x1^2 y1^2 x1y1 x1 y1 1
x2^2 y2^2 x2y2 x2 y2 1
...
xn^2 yn^2 xnyn xn yn 1
3) Make an nx1 matrix of the z values of the points b =
z1
z2
...
zn
4) Solve [tex]M [a b c d e f]^T = b[/tex]
Now I have a function that will plot a quadratic surface given the following a0 - a9:
[tex]F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9[/tex]
clearly a0 = a, a1 = b, a2 = 0, a3 = c, a4 = 0, a5 = 0, a6 = d, a7 = e
But I'm not sure about a8 and a9. I think a9=f, but what do I do with the coefficient of z (a8) in F(x,y,z) ?
Thanks,
Dave
1) Assume the function is in the form:
[tex]a x^2 + b y^2 + c xy + d x + e y + f = z[/tex]
2) Make a nx6 matrix of the points put into (1), that is A=:
x1^2 y1^2 x1y1 x1 y1 1
x2^2 y2^2 x2y2 x2 y2 1
...
xn^2 yn^2 xnyn xn yn 1
3) Make an nx1 matrix of the z values of the points b =
z1
z2
...
zn
4) Solve [tex]M [a b c d e f]^T = b[/tex]
Now I have a function that will plot a quadratic surface given the following a0 - a9:
[tex]F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9[/tex]
clearly a0 = a, a1 = b, a2 = 0, a3 = c, a4 = 0, a5 = 0, a6 = d, a7 = e
But I'm not sure about a8 and a9. I think a9=f, but what do I do with the coefficient of z (a8) in F(x,y,z) ?
Thanks,
Dave