summaryrefslogtreecommitdiff
path: root/1205/CH5/EX5.11/S_5_11.sce
blob: 23d27e65586523020dcd7214284c9d4b56fcba20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clc;
n=3; // no of component
r=60;//mm, radius
l=100;//mm length of cylinder
V=[0.5*4/3*%pi*(r)^3,%pi*r*r*l,-%pi/3*r*r*l];//mm^3, Volumes of Hemisphere, cylinder and cone respectively
x=[-3/8*r,l/2,3/4*l];//mm, x components of centroids of Hemisphere, cylinder and cone respectively

sumV=0;
sumxV=0;

for(i=1:n)
    sumV=sumV+V(i);
    sumxV=sumxV+x(i)*V(i);
    
end



//Location of centre of gravity
X=sumxV/sumV;// X co-ordinate

printf("Co-ordinates of centroid are X= %.0f mm \n",X);