summaryrefslogtreecommitdiff
path: root/3793/CH2/EX2.2
diff options
context:
space:
mode:
Diffstat (limited to '3793/CH2/EX2.2')
-rw-r--r--3793/CH2/EX2.2/exp_2_2.sce25
1 files changed, 25 insertions, 0 deletions
diff --git a/3793/CH2/EX2.2/exp_2_2.sce b/3793/CH2/EX2.2/exp_2_2.sce
new file mode 100644
index 000000000..a185fff41
--- /dev/null
+++ b/3793/CH2/EX2.2/exp_2_2.sce
@@ -0,0 +1,25 @@
+clear;
+clc;
+function [r,th]=rect2pol(x,y)
+//rectangle to polar coordinate conversion
+ r=sqrt(x^2+y^2);
+ th = atan(y,x)*180/%pi;
+endfunction
+ // linear cominations
+ // 1 part (1+a)
+ a=complex((-0.5),0.866);
+ b=1+a;
+ [r,th]=rect2pol(real(b),imag(b));
+ mprintf("a) magnitude = %f, Angle = %f\n",r,th);
+ // 2 part (a^2 - 1)
+c=((a^2)-1)
+[r,th]=rect2pol(real(c),imag(c));
+ mprintf(" b) magnitude = %f, Angle = %f\n",r,th);
+ // 3 part (a^2 + a)
+d=((a^2)+a)
+[r,th]=rect2pol(real(d),imag(d));
+ mprintf(" c) magnitude = %f, Angle = %f\n",r,th);
+ // 4 part (a^2 + a + 1)
+e=((a^2)+a+1)
+[r,th]=rect2pol(real(e),imag(e));
+ mprintf(" d) magnitude = %f, Angle = %f",r,th);