From f35ea80659b6a49d1bb2ce1d7d002583f3f40947 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:38:01 +0530 Subject: updated the code --- 854/CH1/EX1.2/Example1_2.sce | 47 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to '854/CH1/EX1.2') 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 -- cgit