% ajustement d'un cercle R = [83 64 50 54 70 88 93 91] theta = [0 45 90 135 180 225 270 315] theta_rad = theta * pi/180 x = R.*cos(theta_rad) y = R.*sin(theta_rad) X = [sum(x) sum(y) length(R); sum(x.^2) sum(x.*y) sum(x); sum(x.*y) sum(y.^2) sum(y) ] A = [sum(x.^2)+sum(y.^2); sum(x.^3)+sum(x.*y.^2); sum(x.^2.*y)+sum(y.^3)] Q = inv(X)*A a = Q(1) /2 b = Q(2) /2 c = Q(3) R2 = c + a^2 + b^2 Rayon = sqrt(R2) figure hold on plot (x, y, 'o') circle (Rayon, a, b) xlim ([-100 100]) ylim ([-100 100]) axis square grid on % calcul des erreurs de mesure radiale R_reel = sqrt ((x - a).^2 + (y - b).^2) erreur_R = R_reel - Rayon % écart-type sigma_R = std (erreur_R) % erreur avec facteur de confiance de 95% err_R_95 = sigma_R * 2.37