summaryrefslogtreecommitdiff
path: root/692/CH14
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /692/CH14
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 '692/CH14')
-rwxr-xr-x692/CH14/EX14.1/P14_1.sce35
-rwxr-xr-x692/CH14/EX14.2/P14_2.sce33
2 files changed, 68 insertions, 0 deletions
diff --git a/692/CH14/EX14.1/P14_1.sce b/692/CH14/EX14.1/P14_1.sce
new file mode 100755
index 000000000..0f7c952c9
--- /dev/null
+++ b/692/CH14/EX14.1/P14_1.sce
@@ -0,0 +1,35 @@
+//Example 14.1
+//EFFECT OF DFT LENGTH ON SPECTRAL ANALYSIS
+clear;
+clc;
+N=16;
+n=0:N-1;
+f1=0.22;
+f2=0.34;
+
+R = input("R point DFT(R E [16,128]) = "); //Input f1 = 64
+if R >= N
+ x=0.5*(sin(2*%pi*f1*n')) + sin(sin(2*%pi*f2*n'));
+ x=[x',zeros(1,R-length(n))];
+ disp(x,'the sequence is :');
+ for n=0:R-1
+ for k=0:R-1
+ W(n+1,k+1) = exp(-(%i*2*%pi*k/R)*n);
+ end
+ end
+ X = W*x';
+ disp(X,'DFT is, X = ')
+else
+ disp('invalid computation');
+end
+m=0:R-1;
+clf();
+figure(0)
+a = gca();
+plot2d3(m,abs(X),2) // plotting DFT of sequence
+plot(m,abs(X),'r.')
+a.x_location = 'origin';
+a.y_location = 'origin';
+poly1 = a . children (1) . children (1) ;
+poly1.thickness = 2.5;
+xtitle('original sequence','n','x[n]');
diff --git a/692/CH14/EX14.2/P14_2.sce b/692/CH14/EX14.2/P14_2.sce
new file mode 100755
index 000000000..95142f259
--- /dev/null
+++ b/692/CH14/EX14.2/P14_2.sce
@@ -0,0 +1,33 @@
+//Example 14.2
+//EFFECT OF DFT LENGTH ON SPECTRAL ANALYSIS
+clear;
+clc;
+N=16;
+n=0:N-1;
+f1=input("Enter f1 value between 0.28 to 0.31 = "); //Input f1 = 64
+f2=0.34;
+
+R = 128//
+//DFT of the sequence x[n]
+ x=0.5*(sin(2*%pi*f1*n')) + sin((2*%pi*f2*n'));
+ x=[x',zeros(1,R-length(n))];
+ disp(x,'the sequence is :');
+ for n=0:R-1
+ for k=0:R-1
+ W(n+1,k+1) = exp(-(%i*2*%pi*k/R)*n);
+ end
+ end
+ X = W*x';
+ disp(X,'DFT is, X = ')
+//plotting DFT of sequence
+m=0:R-1;
+clf();
+figure(0)
+a = gca();
+plot2d3(m,abs(X),2)
+plot(m,abs(X),'r.')
+a.x_location = 'origin';
+a.y_location = 'origin';
+poly1 = a . children (1) . children (1) ;
+poly1.thickness = 2.5;
+xtitle('original sequence','n','x[n]');