diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /2279/CH7/EX7.3 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '2279/CH7/EX7.3')
-rwxr-xr-x | 2279/CH7/EX7.3/eg_7_3.sce | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/2279/CH7/EX7.3/eg_7_3.sce b/2279/CH7/EX7.3/eg_7_3.sce new file mode 100755 index 000000000..310d1b57c --- /dev/null +++ b/2279/CH7/EX7.3/eg_7_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)")
|