Circle Fitting to Data
One form of the least square regression of a circle to data was published in "The Bent of Tau Beta Pi" in the Spring, 2008 issue. The concept is demonstrated here in two interactive spreadsheets, with the modules written in MS Excel VBA.
The first uses a few points, and shows the sensitivity of the result to the location of the two points that the user is able to move about. The second supposes that the data to be fit is in an arc of some length, and "noise" can be introduced to show how the resulting fit is attenuated. For a small arc, a little noise greatly disrupts the result.
One form of the least square regression of a circle to data was published in "The Bent of Tau Beta Pi" in the Spring, 2008 issue. The concept is demonstrated here in two interactive spreadsheets, with the modules written in MS Excel VBA.
The first uses a few points, and shows the sensitivity of the result to the location of the two points that the user is able to move about. The second supposes that the data to be fit is in an arc of some length, and "noise" can be introduced to show how the resulting fit is attenuated. For a small arc, a little noise greatly disrupts the result.
02_circle_lsq_v06.xls | |
File Size: | 108 kb |
File Type: | xls |
11_circle_fit_1_galer_arc_v02.xls | |
File Size: | 199 kb |
File Type: | xls |
Suppose the object travels at a more or less constant velocity, and that the data is taken as ordered spatial pairs with a time stamp. This suggests a regression to not only an arc, but to points along the arc. The resulting non-linear regression is demonstrated in the next interactive spreadsheet, and the derivation document follows.
17_circle_fit_3_v09.xls | |
File Size: | 189 kb |
File Type: | xls |
17_circle_fit_3_derivation_v06.pdf | |
File Size: | 45 kb |
File Type: |
The spreadsheet demonstrates techniques as well as the regression.
First, the target data that the regression uses is constructed from the same variables as the model, allowing an immediate qualitative assessment of the success of the regression.
Second, noise is added to this target data to assess the sensitivity of the regression to noise. Note that the Excel function RAND() was used, which is not truly random, so each of the trial noise vectors had some of the bias (mean, slope and curvature) removed with a second order regression.
Third, a hybrid technique is used for the solution of the non-linear regression. In this case, there are five unknowns, but the two unknowns embedded in the trigonometric functions defy closed form solution. Three of the unknowns are found as functions of the two unknowns embedded in the transcendental functions, and tag along as Newton’s Method is used. A general purpose non-linear equation package would use iterative techniques on all five unknowns.
This regression suggests other formulations, of course the subject of further work. The Excel demonstration reveals that data covering more of an arc reduces the sensitivity to noise. It also reveals that this parametric formulation is rather less sensitive to noise then the Galer formulation, although the constraints are admittedly a special case. The Galer formulation provides a good initial value almost all the time. This parametric regression seems capable of pulling reasonable results out of some rather noisy data.
First, the target data that the regression uses is constructed from the same variables as the model, allowing an immediate qualitative assessment of the success of the regression.
Second, noise is added to this target data to assess the sensitivity of the regression to noise. Note that the Excel function RAND() was used, which is not truly random, so each of the trial noise vectors had some of the bias (mean, slope and curvature) removed with a second order regression.
Third, a hybrid technique is used for the solution of the non-linear regression. In this case, there are five unknowns, but the two unknowns embedded in the trigonometric functions defy closed form solution. Three of the unknowns are found as functions of the two unknowns embedded in the transcendental functions, and tag along as Newton’s Method is used. A general purpose non-linear equation package would use iterative techniques on all five unknowns.
This regression suggests other formulations, of course the subject of further work. The Excel demonstration reveals that data covering more of an arc reduces the sensitivity to noise. It also reveals that this parametric formulation is rather less sensitive to noise then the Galer formulation, although the constraints are admittedly a special case. The Galer formulation provides a good initial value almost all the time. This parametric regression seems capable of pulling reasonable results out of some rather noisy data.
Disclaimer...
The software is provided only for the education, instruction, and enjoyment of the user. It is not to be used for any commercial enterprise. No warranty is expressed or implied.
Since there is no warranty, I cannot be liable for any damages, direct, indirect, or otherwise incidental, as a result of the use this software.
Some of the modules are copyright protected, and those that are, are so noted in the header of each subroutine. The material that has copyright protection of course may not be used without the explicit written consent of the author.
For the material that is not covered by copyright protection that is used elsewhere, a simple and proper attribution would be appreciated.
The software is provided only for the education, instruction, and enjoyment of the user. It is not to be used for any commercial enterprise. No warranty is expressed or implied.
Since there is no warranty, I cannot be liable for any damages, direct, indirect, or otherwise incidental, as a result of the use this software.
Some of the modules are copyright protected, and those that are, are so noted in the header of each subroutine. The material that has copyright protection of course may not be used without the explicit written consent of the author.
For the material that is not covered by copyright protection that is used elsewhere, a simple and proper attribution would be appreciated.