summaryrefslogtreecommitdiff
path: root/3862/CH4/EX4.7/Ex4_7.sce
blob: bdd81f46dcd1f5c6dbe1c56b0f8e6c016746c287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
clear
// Note that it is convenient to take axis in such a way that the centroids of all simple figures are having positive coordinates. If coordinate of any simple figure comes out to be negative, one should be careful in assigning the sign of moment of area 

//variable declaration

A1=2.0*6.0*1.0/2.0              //Area of 1,m^2
A2=2.0*7.5                      //Area of 2,m^2
A3=3.0*5.0*1.0/2                //Area of 3,m^2
A4=1.0*4.0                      //Area of 4,m^2

//The composite figure can be conveniently divided into two triangles and two rectangle

X1=2.0*2.0/3.0
X2=2.0+1.0
X3=2.0+2.0+(1.0*3.0/3.0)
X4=4.0+4.0/2.0

Y1=6.0/3.0
Y2=7.5/2.0
Y3=1.0+5.0/3.0
Y4=1/2.0

A=A1+A2+A3+A4

xc=(A1*X1+A2*X2+A3*X3+A4*X4)/A

printf("\n xc= %0.3f  m",xc)


yc=(A1*Y1+A2*Y2+A3*Y3+A4*Y4)/A

printf("\n yc= %0.3f  m",yc)