summaryrefslogtreecommitdiff
path: root/830/CH5/EX5.1.2
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /830/CH5/EX5.1.2
parent7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff)
downloadScilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip
updated the code
Diffstat (limited to '830/CH5/EX5.1.2')
-rwxr-xr-x830/CH5/EX5.1.2/DFT1.sce70
1 files changed, 35 insertions, 35 deletions
diff --git a/830/CH5/EX5.1.2/DFT1.sce b/830/CH5/EX5.1.2/DFT1.sce
index 08f5a1efd..597eebc63 100755
--- a/830/CH5/EX5.1.2/DFT1.sce
+++ b/830/CH5/EX5.1.2/DFT1.sce
@@ -1,35 +1,35 @@
-//Graphical//
-//Example 5.1.2
-//Determination of N-point DFT
-//Plotting Magnitude and Phase spectrum
-clear;
-clc;
-close;
-L = 10; // Length of the sequence
-N = 10; // N -point DFT
-for n =0:L-1
- x(n+1) = 1;
-end
-//Computing DFT and IDFT
-X = dft(x,-1)
-x_inv =abs(dft(X,1))
-//Computing Magnitude and Phase Spectrum
-//Using DTFT
-n = 0:L-1;
-K = 500;
-k = 0:1:K;
-w = 2*%pi*k/K;
-X_W = x * exp(-sqrt(-1)*n'*w);
-Mag_X = abs(X_W);
-//phasemag used to calculate phase and magnitude in dB
-Phase_X = atan(imag(X_W),real(X_W))
-subplot(2,1,1)
-plot2d(w,Mag_X)
-xlabel('Frequency in Radians')
-ylabel('abs(X)')
-title('Magnitude Response')
-subplot(2,1,2)
-plot2d(w,Phase_X)
-xlabel('Frequency in Radians')
-ylabel('<(X)')
-title('Phase Response')
+//Graphical//
+//Example 5.1.2
+//Determination of N-point DFT
+//Plotting Magnitude and Phase spectrum
+clear;
+clc;
+close;
+L = 10; // Length of the sequence
+N = 10; // N -point DFT
+for n =0:L-1
+ x(n+1) = 1;
+end
+//Computing DFT and IDFT
+X = fft(x,-1)
+x_inv =abs(fft(X,1))
+//Computing Magnitude and Phase Spectrum
+//Using DTFT
+n = 0:L-1;
+K = 500;
+k = 0:1:K;
+w = 2*%pi*k/K;
+X_W = x' * exp(-sqrt(-1)*n'*w);
+Mag_X = abs(X_W);
+//phasemag used to calculate phase and magnitude in dB
+Phase_X = atan(imag(X_W),real(X_W))
+subplot(2,1,1)
+plot2d(w,Mag_X)
+xlabel('Frequency in Radians')
+ylabel('abs(X)')
+title('Magnitude Response')
+subplot(2,1,2)
+plot2d(w,Phase_X)
+xlabel('Frequency in Radians')
+ylabel('&lt;(X)')
+title('Phase Response') \ No newline at end of file