summaryrefslogtreecommitdiff
path: root/854/CH1/EX1.2/Example1_2.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /854/CH1/EX1.2/Example1_2.sce
parent7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff)
downloadScilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip
updated the code
Diffstat (limited to '854/CH1/EX1.2/Example1_2.sce')
-rwxr-xr-x854/CH1/EX1.2/Example1_2.sce47
1 files changed, 24 insertions, 23 deletions
diff --git a/854/CH1/EX1.2/Example1_2.sce b/854/CH1/EX1.2/Example1_2.sce
index 225fc4169..ac185a2e1 100755
--- a/854/CH1/EX1.2/Example1_2.sce
+++ b/854/CH1/EX1.2/Example1_2.sce
@@ -1,23 +1,24 @@
-//clear//
-//Caption: Program to find the phase angle between two vectors
-//Example1.2
-//page 11
-clc;
-Q = [4,5,2]; //point Q
-x = Q(1);
-y = Q(2);
-z = Q(3);
-G = [y,-2.5*x,3]; //vector field
-disp(G,'G(rQ) =')
-aN = [2/3,1/3,-2/3]; //unit vector- direction of Q
-G_dot_aN = dot(G,aN); //dot product of G and aN
-disp(G_dot_aN,'G.aN =')
-G_dot_aN_aN = G_dot_aN*aN;
-disp(G_dot_aN_aN,'(G.aN)aN=')
-teta_Ga = Phase_Angle(G,aN) //phase angle between G and unit vector aN
-disp(teta_Ga,'phase angle between G and unit vector aN in degrees =')
-//Result
-// G(rQ) = 5. - 10. 3.
-// G.aN = - 2.
-// (G.aN)aN = - 1.3333333 - 0.6666667 1.3333333
-// phase angle between G and unit vector aN in degrees = 99.956489
+//Caption: Program to find the phase angle between two vectors
+//Example1.2
+//page 11
+clc;
+clear
+Q = [4,5,2]; //point Q
+x = Q(1);
+y = Q(2);
+z = Q(3);
+G = [y,-2.5*x,3]; //vector field
+disp(G,'G(rQ) =')
+aN = [2/3,1/3,-2/3]; //unit vector- direction of Q
+G_dot_aN = sum(G.*aN); //dot product of G and aN
+disp(G_dot_aN,'G.aN =')
+G_dot_aN_aN = G_dot_aN*aN;
+disp(G_dot_aN_aN,'(G.aN)aN=')
+teta_Ga = 2 * atand(norm(G*norm(aN) - norm(G)*aN) / norm(G * norm(aN) + norm(G) * aN))
+ //phase angle between G and unit vector aN
+disp(teta_Ga,'phase angle between G and unit vector aN in degrees =')
+//Result
+// G(rQ) = 5. - 10. 3.
+// G.aN = - 2.
+// (G.aN)aN = - 1.3333333 - 0.6666667 1.3333333
+// phase angle between G and unit vector aN in degrees = 99.956489 \ No newline at end of file