From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 3137/CH10/EX10.17/Ex10_17.sce | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 3137/CH10/EX10.17/Ex10_17.sce (limited to '3137/CH10/EX10.17') 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) -- cgit