summaryrefslogtreecommitdiff
path: root/3137/CH10/EX10.17
diff options
context:
space:
mode:
Diffstat (limited to '3137/CH10/EX10.17')
-rwxr-xr-x3137/CH10/EX10.17/Ex10_17.sce16
1 files changed, 16 insertions, 0 deletions
diff --git a/3137/CH10/EX10.17/Ex10_17.sce b/3137/CH10/EX10.17/Ex10_17.sce
new file mode 100755
index 000000000..750ef8dea
--- /dev/null
+++ b/3137/CH10/EX10.17/Ex10_17.sce
@@ -0,0 +1,16 @@
+//Initilization of variables
+tx=30 //degrees
+ty=45 //degrees
+tz=60 //degrees
+//Calculations
+V=[10,15,25] //in^3
+x_bar=[4,12,24] //in
+y_bar=[4*cosd(tx),-6*cosd(ty),-4*cosd(tz)]
+z_bar=[-4*sind(tx),6*sind(ty),-4*sind(tz)]
+//Centroid calculations
+x=(V(1)*x_bar(1)+V(2)*x_bar(2)+V(3)*x_bar(3))/(V(1)+V(2)+V(3)) //in
+y=(V(1)*y_bar(1)+V(2)*y_bar(2)+V(3)*y_bar(3))/(V(1)+V(2)+V(3)) //in
+z=(V(1)*z_bar(1)+V(2)*z_bar(2)+V(3)*z_bar(3))/(V(1)+V(2)+V(3)) //in
+//Result
+clc
+printf('The centroid is at x=%f in,y=%f in and z=%f in',x,y,z)