Fit Circle to Weighted (x,y,w) Data
Versión 1.0.0 (2,19 KB) por
James Akula
This program fits a circle to weighted set of 2D data.
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
Citar como
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. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2021b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0 |