# Centroid of semi-circular arc vs Average of coordinates

Equation for the centroid a semi circular arc is x=2*r/(pi). If I have a circle with 1 cm of radius then its centroid is 2r/(pi)= 0.637 cm. Now I use the equation of this circle x^2+y^2=1^2 in Matlab to find all x coordinates of the circle. Then I find the mean of the all x coordinates, which is equal to 0.7812 cm.

According to definition of centroid: "Centroid is the mean position of all the points in all of the coordinate directions". Why does calculated mean value of x coordinates is not same as the value of centroid calculated by equation "x=2*r/(pi)" ?.

Here is the MATLAB code:

close all

clear all

y=1:-0.01:-1;

x= sqrt( 1-y.^2);

a=mean (x)

figure;

plot(x,y)

• A circumference is the border of the circle. The centroid formula $2r/\pi$ is for a circle, while you are asking Mathlab for an average of a circumference. – Ripi2 Jan 13 at 21:02