blob: 2d226987d5db50f328cafc8f73ab4a8c77b004fe (
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
|
clear
// The composite section is divided into three simple figures, a triangle, a rectangle and a semicircle
//
//variable declaration
A1=1.0*3.0*4.0/2.0 //Area of 1,m^2
A2=6.0*4.0 //Area of 2,m^2
A3=1.0*%pi*(2**2)/2 //Area of 3**m^2
//The coordinates of centroids of these three simple figures are:
X1=6.0+3.0/3.0
X2=3.0
X3=-(4*2)/(3.0*%pi)
Y1=4.0/3.0
Y2=2.0
Y3=2.0
A=A1+A2+A3
xc=(A1*X1+A2*X2+A3*X3)/A
printf("\n xc= %0.4f m",xc)
yc=(A1*Y1+A2*Y2+A3*Y3)/A
printf("\n yc= %0.3f m",yc)
|