summaryrefslogtreecommitdiff
path: root/2279/CH7/EX7.3/Ex7_3.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /2279/CH7/EX7.3/Ex7_3.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '2279/CH7/EX7.3/Ex7_3.sce')
-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)")