summaryrefslogtreecommitdiff
path: root/2279/CH7/EX7.3
diff options
context:
space:
mode:
Diffstat (limited to '2279/CH7/EX7.3')
-rw-r--r--2279/CH7/EX7.3/Ex7_3.sce32
1 files changed, 32 insertions, 0 deletions
diff --git a/2279/CH7/EX7.3/Ex7_3.sce b/2279/CH7/EX7.3/Ex7_3.sce
new file mode 100644
index 000000000..310d1b57c
--- /dev/null
+++ b/2279/CH7/EX7.3/Ex7_3.sce
@@ -0,0 +1,32 @@
+//DTFS of x[n] =2cos((pi/3)*n+(pi/6))
+clear;
+close;
+clc;
+n = -3:3;
+N = 6;
+Wo = 2*%pi/N;
+xn = 2*cos((%pi/3)*n+(%pi/6));
+//By euler's theorem X[n] can be represented
+x_n=exp(%i*(%pi*n/3)+%pi/6)+exp(-%i*(%pi*n/3)+%pi/6)
+for i=1:length(n)
+ if n(i)==1
+ a(i)=exp(%i*%pi/6);
+ elseif n(i)==-1
+ a(i)=exp(-%i*%pi/6);
+ else
+ a(i)=0;
+ end
+end
+for i=1:length(a)
+ if real(a(i))==0 then
+ phase(i)=0;
+ else
+ phase(i)=atan(imag(a(i))/real(a(i)));
+end
+end
+subplot(2,1,1)
+plot2d3('gnn',n,abs(a))
+xtitle("MAgnitude spectrum","k","|ak|")
+subplot(2,1,2)
+plot2d3('gnn',n,phase)
+xtitle("Phase spectrum","k","angle(ak)")