Fit Circle to Weighted (x,y,w) Data

版本 1.0.0 (2.2 KB) 作者: James Akula
This program fits a circle to weighted set of 2D data.
18.0 次下载
更新时间 2022/5/13

查看许可证

weightedFitCircle Fits a circle to a list of datapoints X, Y, and weights W using fminsearch with specifiable options. Initial parameters are obtained using SVD (SVD approach inspired by https://people.cas.uab.edu/~mosya/cl/TaubinSVD.m).
Returns
CXCYout: XY of circle center
Rout: Radius of circle
RMS: Orthogonal, weighted, root mean squared error
exitFlag: Exit condition of fit
Example code showing that fitting is fast and accurate:
X = 1./rand(1, 6); Y = 1./rand(1, 6); W = rand(1, 6);
tic
[CXCYout, Rout, RMSE] = ...
weightedFitCircle(X, Y, W, optimset('Display', 'Iter'));
toc
disp(['(X,Y,R) = ', num2str([CXCYout, Rout])])
disp(['RMSE = ', num2str(RMSE)])
plot(CXCYout(1) + Rout*cos(0:0.00001:2.001*pi), ...
CXCYout(2) + Rout*sin(0:0.00001:2.001*pi), '--k')
hold on
scatter(X, Y, W/max(W)*75, 'r')
axis equal

引用格式

James Akula (2024). Fit Circle to Weighted (x,y,w) Data (https://www.mathworks.com/matlabcentral/fileexchange/111560-fit-circle-to-weighted-x-y-w-data), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2021b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0