summaryrefslogtreecommitdiff
path: root/716/CH9/EX9.2.V
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /716/CH9/EX9.2.V
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '716/CH9/EX9.2.V')
-rwxr-xr-x716/CH9/EX9.2.V/9_13_ExerciseV9_2.sce21
1 files changed, 21 insertions, 0 deletions
diff --git a/716/CH9/EX9.2.V/9_13_ExerciseV9_2.sce b/716/CH9/EX9.2.V/9_13_ExerciseV9_2.sce
new file mode 100755
index 000000000..61584df58
--- /dev/null
+++ b/716/CH9/EX9.2.V/9_13_ExerciseV9_2.sce
@@ -0,0 +1,21 @@
+//Perform 4 point DFT of x(n)=(0 -1 2 1) and sketch magnitude and phase spectrum
+clc;
+clear;
+N=4;
+xn=[0 -1 2 1];
+for k=0:1:N-1
+ Xk(k+1)=0;
+ for n=0:1:N-1
+ Xk(k+1)=Xk(k+1)+xn(n+1)*exp(-%i*2*%pi*k*n/N);
+ end
+end
+wk=0:1:N-1;
+disp(Xk,'4 point DFT of x(n)=>');
+disp(abs(Xk),'magnitude of 4 point DFT x(n)=>');
+disp(atan(imag(Xk),real(Xk)),'phase of 4 point DFT x(n)=>');
+subplot(1,2,1)
+plot2d3(wk,abs(Xk),2);
+xtitle('Magnitude Spectrum','k','|X(k)|');
+subplot(1,2,2)
+plot2d3(wk,atan(imag(Xk),real(Xk)),2);
+xtitle('Phase Spectrum','k','angle(X(k))'); \ No newline at end of file