If the equation is r=ax+by+cz+d the algorithm uses simple matrices:
(X<sup>T</sup> * X) * (X<sup>T</sup> * R) = [ a ; b ; c ; d ]
With:
X = [ x<sub>1</sub> , y<sub>1</sub> , z<sub>1</sub> , 1 ; x<sub>2</sub> , y<sub>2</sub> , z<sub>2</sub> , 1 ; ... ; x<sub>n</sub> , y<sub>n</sub> , z<sub>n</sub> , 1 ]
and
R = [ r<sub>1</sub> ; r<sub>2</sub> ; ... r<sub>n</sub> ]
Some notes:
For this to actually work, n must be equal to or greater than 4. If you have only 4 points then you are finding an exact equation, if n is greater than 4 then it is a best fit ... hyperplane.
If you have a graphing calculator it can perform these matrix equations. If you know some basic programming you can make the computer perform these equations. You can even make Excel perform these computations. It would be easiest to have a graphing calculator at the ready... those other two methods require a lot of work, luckily the amount of work is not determined by the number of points in your data.
Last edited by Hain; 12-08-2007 at 12:06 PM..
|