summaryrefslogtreecommitdiff
path: root/3137/CH1/EX1.15
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /3137/CH1/EX1.15
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '3137/CH1/EX1.15')
-rwxr-xr-x3137/CH1/EX1.15/Ex1_15.sce21
1 files changed, 21 insertions, 0 deletions
diff --git a/3137/CH1/EX1.15/Ex1_15.sce b/3137/CH1/EX1.15/Ex1_15.sce
new file mode 100755
index 000000000..1e2f9a1fb
--- /dev/null
+++ b/3137/CH1/EX1.15/Ex1_15.sce
@@ -0,0 +1,21 @@
+//Initilization of variables
+x1=2 //units
+x2=-2 //units
+y1=3 //units
+y2=4 //units
+z1=0 //units
+z2=6 //units
+P=[2,3,-1] //units
+//Calculations
+X=sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2) //units
+eLx=(x2-x1)/X //units
+eLy=(y2-y1)/X //units
+eLz=(z2-z1)/X //units
+Q=[eLx,eLy,eLz] //units
+Z=P*Q' //units
+//Result
+clc
+printf('The unit vector is:%fi+%fj+%fk \n',eLx,eLy,eLz)
+printf('The projection of P is:%f',Z)
+//Note:The final answer for the projection of P is off by 0.1 units
+//The answer mentioned in the textbook is -1.41