Fit Circle to Weighted (x,y,w) Data
Versione 1.0.0 (2,19 KB) da
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
Cita come
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. Recuperato .
Compatibilità della release di MATLAB
Creato con
R2021b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS LinuxTag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
Versione | Pubblicato | Note della release | |
---|---|---|---|
1.0.0 |