diff options
Diffstat (limited to '758')
-rwxr-xr-x | 758/CH6/EX6.1/Ex_6_1.sce | 52 | ||||
-rwxr-xr-x | 758/CH6/EX6.10/Ex_6_10.sce | 37 | ||||
-rwxr-xr-x | 758/CH6/EX6.11/Ex_6_11.sce | 22 | ||||
-rwxr-xr-x | 758/CH6/EX6.12/Ex_6_12.sce | 20 | ||||
-rwxr-xr-x | 758/CH6/EX6.13/Ex_6_13.sce | 16 | ||||
-rwxr-xr-x | 758/CH6/EX6.14/Ex_6_14.sce | 16 | ||||
-rwxr-xr-x | 758/CH6/EX6.35/Ex_6_35.sce | 50 | ||||
-rwxr-xr-x | 758/CH6/EX6.8/Ex_6_8.sce | 18 | ||||
-rwxr-xr-x | 758/CH6/EX6.9/Ex_6_9.sce | 20 | ||||
-rwxr-xr-x | 758/CH9/EX9.4/Ex_9_4.sce | 12 | ||||
-rwxr-xr-x | 758/CH9/EX9.5.a/Ex_9_5_a.sce | 24 | ||||
-rwxr-xr-x | 758/CH9/EX9.5.b/Ex_9_5_b.sce | 24 |
12 files changed, 155 insertions, 156 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-->');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-->');
\ 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 diff --git a/758/CH9/EX9.4/Ex_9_4.sce b/758/CH9/EX9.4/Ex_9_4.sce index e13b899bc..81d647f10 100755 --- a/758/CH9/EX9.4/Ex_9_4.sce +++ b/758/CH9/EX9.4/Ex_9_4.sce @@ -1,7 +1,7 @@ -//Example 9.4
-clc;clear;close;
-z=poly(0,'z');
-Hz=2*(z+2)/(z*(z-0.1)*(z+0.5)*(z+0.4));
-H=dscr(Hz);
-disp(Hz,'System Function H(z)=');
+//Example 9.4 +clc;clear;close; +z=poly(0,'z'); +Hz=2*(z+2)/(z*(z-0.1)*(z+0.5)*(z+0.4)); +H=dscr(Hz,0.1); +disp(Hz,'System Function H(z)='); disp(H,'System Function for cascade realisation Hk(z)=');
\ No newline at end of file diff --git a/758/CH9/EX9.5.a/Ex_9_5_a.sce b/758/CH9/EX9.5.a/Ex_9_5_a.sce index d1d12b0a9..595552baf 100755 --- a/758/CH9/EX9.5.a/Ex_9_5_a.sce +++ b/758/CH9/EX9.5.a/Ex_9_5_a.sce @@ -1,12 +1,12 @@ -//Example 9.5.a
-clc;clear;close;
-z=poly(0,'z');
-s=poly(0,'s');
-Hz=3*(2*z^2+5*z+4)/(2*z+1)/(z+2);
-H=pfss(Hz/z);
-for k=1:length(H)
- H(k)=clean(H(k));
- H1(k)=z*horner(H(k),z);
-end
-disp(Hz,'System Function H(z)=');
-disp(H1,'System Function for parallel realisation Hk(z)=');
\ No newline at end of file +//Example 9.5.a +clc;clear;close; +z=poly(0,'z'); +s=poly(0,'s'); +Hz=3*(2*z^2+5*z+4)/(2*z+1)/(z+2); +H=pfss(Hz/z); +for k=1:length(H) + H(k)=clean(H(k)); + H1(k)=z*horner(H(k),z); +disp(H1(k),'System Function for parallel realisation Hk(z)='); +end +disp(Hz,'System Function H(z)=');
\ No newline at end of file diff --git a/758/CH9/EX9.5.b/Ex_9_5_b.sce b/758/CH9/EX9.5.b/Ex_9_5_b.sce index 4bd62bbd1..e86f814d4 100755 --- a/758/CH9/EX9.5.b/Ex_9_5_b.sce +++ b/758/CH9/EX9.5.b/Ex_9_5_b.sce @@ -1,12 +1,12 @@ -//Example 9.5.b
-clc;clear;close;
-z=poly(0,'z');
-s=poly(0,'s');
-Hz=3*z*(5*z-2)/(z+1/2)/(3*z-1);
-H=pfss(Hz/z);
-for k=1:length(H)
- H(k)=clean(H(k));
- H1(k)=z*horner(H(k),z);
-end
-disp(Hz,'System Function H(z)=');
-disp(H1,'System Function for parallel realisation Hk(z)=');
\ No newline at end of file +//Example 9.5.b +clc;clear;close; +z=poly(0,'z'); +s=poly(0,'s'); +Hz=3*z*(5*z-2)/(z+1/2)/(3*z-1); +H=pfss(Hz/z); +for k=1:length(H) + H(k)=clean(H(k)); + H1(k)=z*horner(H(k),z); +disp(H1(k),'System Function for parallel realisation Hk(z)='); +end +disp(Hz,'System Function H(z)=');
\ No newline at end of file |