summaryrefslogtreecommitdiff
path: root/758/CH6
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /758/CH6
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 '758/CH6')
-rwxr-xr-x758/CH6/EX6.1/Ex_6_1.sce52
-rwxr-xr-x758/CH6/EX6.10/Ex_6_10.sce37
-rwxr-xr-x758/CH6/EX6.11/Ex_6_11.sce22
-rwxr-xr-x758/CH6/EX6.12/Ex_6_12.sce20
-rwxr-xr-x758/CH6/EX6.13/Ex_6_13.sce16
-rwxr-xr-x758/CH6/EX6.14/Ex_6_14.sce16
-rwxr-xr-x758/CH6/EX6.35/Ex_6_35.sce50
-rwxr-xr-x758/CH6/EX6.8/Ex_6_8.sce18
-rwxr-xr-x758/CH6/EX6.9/Ex_6_9.sce20
9 files changed, 125 insertions, 126 deletions
diff --git a/758/CH6/EX6.1/Ex_6_1.sce b/758/CH6/EX6.1/Ex_6_1.sce
index 653fb1c54..3234ebc07 100755
--- a/758/CH6/EX6.1/Ex_6_1.sce
+++ b/758/CH6/EX6.1/Ex_6_1.sce
@@ -1,27 +1,27 @@
-//Example 6.1
-clc;clear;close;
-x1=[1 1 2 2];
-x2=[1 2 3 4];
-ylength=length(x1);
-//Calculation of linear convolution
-z=convol(x1,x2);
-//Calculation of circular convolution
-for n=1:ylength
- y(n)=0;
- for k=1:ylength,
- l=n-k+1;
- if l <= 0 then
- l=l+ylength;
- end
- y(n)=y(n)+(x1(k)*x2(l));
- end
-end
-//Calculation of circular convolution using DFT and IDFT
-X1=dft(x1,-1);
-X2=dft(x2,-1);
-Y1=X1.*X2;
-y1=dft(Y1,1);
-y1=clean(y1);
-disp(z,'Linear Convolution sequence is z(n): ');
-disp(y,'Circular Convolution sequence is y(n): ');
+//Example 6.1
+clc;clear;close;
+x1=[1 1 2 2];
+x2=[1 2 3 4];
+ylength=length(x1);
+//Calculation of linear convolution
+z=convol(x1,x2);
+//Calculation of circular convolution
+for n=1:ylength
+ y(n)=0;
+ for k=1:ylength,
+ l=n-k+1;
+ if l <= 0 then
+ l=l+ylength;
+ end
+ y(n)=y(n)+(x1(k)*x2(l));
+ end
+end
+//Calculation of circular convolution using DFT and IDFT
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+Y1=X1.*X2;
+y1=fft(Y1,1);
+y1=clean(y1);
+disp(z,'Linear Convolution sequence is z(n): ');
+disp(y,'Circular Convolution sequence is y(n): ');
disp(y1,'Circular Convolution sequence calculated using DFT-IDFT method is y(n): '); \ No newline at end of file
diff --git a/758/CH6/EX6.10/Ex_6_10.sce b/758/CH6/EX6.10/Ex_6_10.sce
index 0719a285e..ea79fa40f 100755
--- a/758/CH6/EX6.10/Ex_6_10.sce
+++ b/758/CH6/EX6.10/Ex_6_10.sce
@@ -1,19 +1,18 @@
-//Example 6.10
-
-clc;clear;close;
-x=[1 1 2 2 3 3];
-//Calculation of DFT
-X=dft(x,-1);
-X=clean(X);
-disp(x,'Given Sequence is x(n): ');
-disp(X,'DFT of the Sequence is X(k): ');
-subplot(3,1,1);
-plot2d3(x);
-title('Given Seqence x[n]:');ylabel('Amplitude-->');xlabel('n-->');
-subplot(3,1,2);
-plot2d3(abs(X));
-title('Magnitude Spectrum |X(k)|');xlabel('k-->');
-subplot(3,1,3);
-plot2d3(atan(X));
-title('Phase Spectrum /_X(k)');xlabel('k-->');
-
+//Example 6.10
+
+clc;clear;close;
+x=[1 1 2 2 3 3];
+//Calculation of DFT
+X=fft(x,-1);
+X=clean(X);
+disp(x,'Given Sequence is x(n): ');
+disp(X,'DFT of the Sequence is X(k): ');
+subplot(3,1,1);
+plot2d3(x);
+title('Given Seqence x[n]:');ylabel('Amplitude--&gt;');xlabel('n--&gt;');
+subplot(3,1,2);
+plot2d3(abs(X));
+title('Magnitude Spectrum |X(k)|');xlabel('k--&gt;');
+subplot(3,1,3);
+plot2d3(atan(X));
+title('Phase Spectrum /_X(k)');xlabel('k--&gt;'); \ No newline at end of file
diff --git a/758/CH6/EX6.11/Ex_6_11.sce b/758/CH6/EX6.11/Ex_6_11.sce
index 6af305e3f..0926c2e06 100755
--- a/758/CH6/EX6.11/Ex_6_11.sce
+++ b/758/CH6/EX6.11/Ex_6_11.sce
@@ -1,12 +1,12 @@
-//Example 6.11
-
-clc;clear;close;
-N=8;A=1/4;
-n=0:N-1;
-x=A^n;
-//Calculation of DFT
-X=dft(x,-1);
-X=clean(X);
-disp(x,'Given Sequence is x(n): ');
-disp(N,'N=')
+//Example 6.11
+
+clc;clear;close;
+N=8;A=1/4;
+n=0:N-1;
+x=A^n;
+//Calculation of DFT
+X=fft(x,-1);
+X=clean(X);
+disp(x,'Given Sequence is x(n): ');
+disp(N,'N=')
disp(X,'N-point DFT of the Sequence is X(k): '); \ No newline at end of file
diff --git a/758/CH6/EX6.12/Ex_6_12.sce b/758/CH6/EX6.12/Ex_6_12.sce
index 0f088a5ed..a08eeae84 100755
--- a/758/CH6/EX6.12/Ex_6_12.sce
+++ b/758/CH6/EX6.12/Ex_6_12.sce
@@ -1,11 +1,11 @@
-//Example 6.12
-
-clc;clear;close;
-N=4;
-n=0:N-1;
-x=cos(%pi/4*n);
-//Calculation of DFT
-X=dft(x,-1);
-X=clean(X);
-disp(x,'Given Sequence is x(n): ');
+//Example 6.12
+
+clc;clear;close;
+N=4;
+n=0:N-1;
+x=cos(%pi/4*n);
+//Calculation of DFT
+X=fft(x,-1);
+X=clean(X);
+disp(x,'Given Sequence is x(n): ');
disp(X,'DFT of the Sequence is X(k): '); \ No newline at end of file
diff --git a/758/CH6/EX6.13/Ex_6_13.sce b/758/CH6/EX6.13/Ex_6_13.sce
index 41780add6..4baf55c5a 100755
--- a/758/CH6/EX6.13/Ex_6_13.sce
+++ b/758/CH6/EX6.13/Ex_6_13.sce
@@ -1,8 +1,8 @@
-//Example 6.13
-clc;clear;close;
-X=[1 2 3 4];
-//Calculation of IDFT
-x=dft(X,1);
-x=clean(x);
-disp(X,'DFT of the Sequence is X(k): ');
-disp(x,'Sequence is x(n): ');
+//Example 6.13
+clc;clear;close;
+X=[1 2 3 4];
+//Calculation of IDFT
+x=fft(X,1);
+x=clean(x);
+disp(X,'DFT of the Sequence is X(k): ');
+disp(x,'Sequence is x(n): '); \ No newline at end of file
diff --git a/758/CH6/EX6.14/Ex_6_14.sce b/758/CH6/EX6.14/Ex_6_14.sce
index c34b8b74e..26540e597 100755
--- a/758/CH6/EX6.14/Ex_6_14.sce
+++ b/758/CH6/EX6.14/Ex_6_14.sce
@@ -1,8 +1,8 @@
-//Example 6.14
-clc;clear;close;
-X=[3 2+%i 1 2-%i];
-//Calculation of IDFT
-x=dft(X,1);
-x=clean(x);
-disp(X,'DFT of the Sequence is X(k): ');
-disp(x,'Sequence is x(n): ');
+//Example 6.14
+clc;clear;close;
+X=[3 2+%i 1 2-%i];
+//Calculation of IDFT
+x=fft(X,1);
+x=clean(x);
+disp(X,'DFT of the Sequence is X(k): ');
+disp(x,'Sequence is x(n): '); \ No newline at end of file
diff --git a/758/CH6/EX6.35/Ex_6_35.sce b/758/CH6/EX6.35/Ex_6_35.sce
index 11e55b4a0..efe00eddb 100755
--- a/758/CH6/EX6.35/Ex_6_35.sce
+++ b/758/CH6/EX6.35/Ex_6_35.sce
@@ -1,25 +1,25 @@
-//Example 6.35
-
-clc;clear;close;
-h=[2 2 1];
-x=[3 0 -2 0 2 1 0 -2 -1 0];
-M=length(h); //length of impulse response
-L=2^M; //length of FFT/IFFT operation
-N=L-M+1;
-xl=length(x);
-K=ceil(xl/N); //number of iterations
-h=[h zeros(1,L-M)];
-x=[zeros(1,M-1) x x(1:K*N-xl)];
-H=fft(h);
-for k=0:K-1
- xk=x(k*N+1:(k+1)*N+M-1);
- Xk=fft(xk);
- Yk=H.*Xk;
- yk=ifft(Yk);
- yk=clean(yk);
- y=[y(1:k*N) yk(M:L)];
- disp(k+1,'Segment =');
- disp(xk,'xk(n)=');
- disp(yk,'yk(n)=');
-end
-disp(y,'Output Sequence is y(n): ');
+//Example 6.35
+
+clc;clear;close;
+h=[2 2 1];
+x=[3 0 -2 0 2 1 0 -2 -1 0];
+M=length(h); //length of impulse response
+L=2^M; //length of FFT/IFFT operation
+N=L-M+1;
+xl=length(x);
+K=ceil(xl/N); //number of iterations
+h=[h zeros(1,L-M)];
+x=[zeros(1,M-1) x x(1:K*N-xl)];
+H=fft(h);
+for k=0:K-1
+ xk=x(k*N+1:(k+1)*N+M-1);
+ Xk=fft(xk);
+ Yk=H.*Xk;
+ yk=ifft(Yk);
+ yk=clean(yk);
+ y=[yk(1:k*N) yk(M:L)];
+ disp(k+1,'Segment =');
+ disp(xk,'xk(n)=');
+ disp(yk,'yk(n)=');
+end
+disp(y,'Output Sequence is y(n): '); \ No newline at end of file
diff --git a/758/CH6/EX6.8/Ex_6_8.sce b/758/CH6/EX6.8/Ex_6_8.sce
index 4c03f0861..57ce83319 100755
--- a/758/CH6/EX6.8/Ex_6_8.sce
+++ b/758/CH6/EX6.8/Ex_6_8.sce
@@ -1,10 +1,10 @@
-//Example 6.8
-
-clc;clear;close;
-L=3;A=1/4;
-x=A*ones(1,L);
-//Calculation of DFT
-X=dft(x,-1);
-X=clean(X);
-disp(x,'Given Sequence is x(n): ');
+//Example 6.8
+
+clc;clear;close;
+L=3;A=1/4;
+x=A*ones(1,L);
+//Calculation of DFT
+X=fft(x,-1);
+X=clean(X);
+disp(x,'Given Sequence is x(n): ');
disp(X,'DFT of the Sequence is X(k): '); \ No newline at end of file
diff --git a/758/CH6/EX6.9/Ex_6_9.sce b/758/CH6/EX6.9/Ex_6_9.sce
index 978ddc838..74b1f4599 100755
--- a/758/CH6/EX6.9/Ex_6_9.sce
+++ b/758/CH6/EX6.9/Ex_6_9.sce
@@ -1,11 +1,11 @@
-//Example 6.9
-
-clc;clear;close;
-L=3;A=1/5;
-n=-1:1;
-x=A*ones(1,L);
-//Calculation of DFT
-X=dft(x,-1);
-X=clean(X);
-disp(x,'Given Sequence is x(n): ');
+//Example 6.9
+
+clc;clear;close;
+L=3;A=1/5;
+n=-1:1;
+x=A*ones(1,L);
+//Calculation of DFT
+X=fft(x,-1);
+X=clean(X);
+disp(x,'Given Sequence is x(n): ');
disp(X,'DFT of the Sequence is X(k): '); \ No newline at end of file