summaryrefslogtreecommitdiff
path: root/3532/CH1/EX1.6/Ex1_6.sce
diff options
context:
space:
mode:
Diffstat (limited to '3532/CH1/EX1.6/Ex1_6.sce')
-rw-r--r--3532/CH1/EX1.6/Ex1_6.sce26
1 files changed, 26 insertions, 0 deletions
diff --git a/3532/CH1/EX1.6/Ex1_6.sce b/3532/CH1/EX1.6/Ex1_6.sce
new file mode 100644
index 000000000..6d4966f45
--- /dev/null
+++ b/3532/CH1/EX1.6/Ex1_6.sce
@@ -0,0 +1,26 @@
+clc
+clear
+mprintf('Mechanical vibrations by G.K.Grover\n Example 1.6.1\n')
+//given data
+//case 1
+//a complex number is represented as Z=X+j*Y where j is imaginary
+//V=3 +j*7
+x1=3
+y1=7
+//calculations
+r1=sqrt(x1^2+y1^2)
+ if (y1/x1)>0 then theta1=atan(y1/x1)
+ else theta1=%pi-atan(abs(y1/x1))
+ end
+theta1=atan(y1/x1)
+//case 2
+//V=-5 +j*4
+x2=-5
+y2=4
+//calculations
+r2=sqrt(x2^2+y2^2)
+ if (y2/x2)>0 then theta1=atan(y2/x2)
+ else theta2=%pi-atan(abs(y2/x2))
+ end
+//output
+mprintf('case(i) V=3+j*7 is represented as V=%3.3f*e^(j*(%3.3f))\ncase(ii) V=-5+j*4 is represented as V=%3.3f*e^(j*(%3.3f))',r1,theta1,r2,theta2)