diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1592/CH5 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1592/CH5')
23 files changed, 331 insertions, 0 deletions
diff --git a/1592/CH5/EX5.1/Example5_1.sce b/1592/CH5/EX5.1/Example5_1.sce new file mode 100755 index 000000000..2377d89fa --- /dev/null +++ b/1592/CH5/EX5.1/Example5_1.sce @@ -0,0 +1,32 @@ +//Scilab Code for Example 5.1 of Signals and systems by
+//P.Ramakrishna Rao
+//Discrete Time Fourier Transform of
+//x[n]= (a^abs(n)) 0<a<1
+clear;
+clc;
+close;
+// DTS Signal
+a = 0.5; //0<a<1
+max_limit = 10;
+n = -max_limit+1:max_limit-1;
+x = a^abs(n);
+// Discrete-time Fourier Transform
+Wmax = 2*%pi;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = x* exp(-sqrt(-1)*n'*W);
+XW_Mag = real(XW);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',n,x);
+xtitle('Discrete Time Sequence x[n] for a>0')
+figure(1);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW_Mag);
+title('Discrete Time Fourier Transform X(exp(jW))')
diff --git a/1592/CH5/EX5.1/Fig5_1_1.jpg b/1592/CH5/EX5.1/Fig5_1_1.jpg Binary files differnew file mode 100755 index 000000000..ae3eea0c4 --- /dev/null +++ b/1592/CH5/EX5.1/Fig5_1_1.jpg diff --git a/1592/CH5/EX5.1/Fig5_1_2.jpg b/1592/CH5/EX5.1/Fig5_1_2.jpg Binary files differnew file mode 100755 index 000000000..38ac34290 --- /dev/null +++ b/1592/CH5/EX5.1/Fig5_1_2.jpg diff --git a/1592/CH5/EX5.11/Example5_11.sce b/1592/CH5/EX5.11/Example5_11.sce new file mode 100755 index 000000000..7cf55d9d9 --- /dev/null +++ b/1592/CH5/EX5.11/Example5_11.sce @@ -0,0 +1,33 @@ +//Scilab Code for Example 5.11 of Signals and systems by
+//P.Ramakrishna Rao
+clear;
+clc;
+wc=1;
+y=1;
+for n=-%pi:%pi/80:%pi
+ if n<-wc | n>wc then
+ X(1,y)=1;
+ y=y+1;
+ else X(1,y)=0;
+ y=y+1;
+ end
+end
+n=-%pi:%pi/80:%pi;
+a = gca ();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(n,X);
+xlabel ( 'Frequency in Radians/Seconds' );
+title ('X(e^jw)) at Wc=1');
+A=1/%pi;
+for k=-10:10
+ x(k+11)=A*integrate('cos(w*k)','w',wc,%pi);
+end
+figure(1);
+k=-10:10;
+a = gca ();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3(k,x);
+xlabel ( 'Time in Seconds' );
+title ('x(n) at Wc=1');
diff --git a/1592/CH5/EX5.11/Fig5_11_1.jpg b/1592/CH5/EX5.11/Fig5_11_1.jpg Binary files differnew file mode 100755 index 000000000..a019650c5 --- /dev/null +++ b/1592/CH5/EX5.11/Fig5_11_1.jpg diff --git a/1592/CH5/EX5.11/Fig5_11_2.jpg b/1592/CH5/EX5.11/Fig5_11_2.jpg Binary files differnew file mode 100755 index 000000000..351d33b60 --- /dev/null +++ b/1592/CH5/EX5.11/Fig5_11_2.jpg diff --git a/1592/CH5/EX5.13/Example5_13.sce b/1592/CH5/EX5.13/Example5_13.sce new file mode 100755 index 000000000..34368805c --- /dev/null +++ b/1592/CH5/EX5.13/Example5_13.sce @@ -0,0 +1,11 @@ +//Scilab Code for Example 5.13 of Signals and systems by
+//P.Ramakrishna Rao
+//Circular Convolution
+clear;
+//First Causal sequence
+x=[1,4,3,2;2,1,4,3;3,2,1,4;4,3,2,1]
+//Second Sequence
+y=[4;3;2;1]
+//Conolution
+z=x*y;
+disp(z,'Convolution Of x & y is:')
diff --git a/1592/CH5/EX5.14/Example5_14.sce b/1592/CH5/EX5.14/Example5_14.sce new file mode 100755 index 000000000..27cc4aed2 --- /dev/null +++ b/1592/CH5/EX5.14/Example5_14.sce @@ -0,0 +1,21 @@ +//Scilab Code for Example 5.14 of Signals and systems by
+//P.Ramakrishna Rao
+//Circular Convolution
+clear;
+clc;
+close;
+//First Causal sequence
+x=[1,1,1,1;1,-%i,-1,%i;1,-1,1,-1;1,%i,-1,-%i]
+y1=[1;2;3;4];
+y2=[4;3;2;1];
+X=x*y1;
+disp(X,'Vector X(0)-->X(3)')
+Y=x*y2;
+disp(Y,'Vector Y(0)-->Y(3)')
+for n=1:4;
+ Z(n,1)=X(n,1)*Y(n,1);
+end
+q=4*x^-1;
+disp(q,'IDFT matrix ');
+z=0.25*q*Z;
+disp(z,'IDFT of Vector Z(0)-->Z(3)')
diff --git a/1592/CH5/EX5.16/Example5_16.sce b/1592/CH5/EX5.16/Example5_16.sce new file mode 100755 index 000000000..dbc8282e7 --- /dev/null +++ b/1592/CH5/EX5.16/Example5_16.sce @@ -0,0 +1,41 @@ +//Scilab Code for Example 5.16 of Signals and systems by
+//P.Ramakrishna Rao
+clc;
+clear;
+q=0;
+x=[1,2,3,4];
+w=0;
+n=0:3;
+z=(exp(-%i*w*n));
+for n=0:3
+ X(n+1)=z(n+1)*x(n+1);
+ q=X(n+1)+q;
+end
+disp(q,'X(0)->zeroth DFT coefficient');
+q=0;
+w=%pi/2;
+n=0:3;
+z=(exp(-%i*w*n));
+for n=0:3
+ X(n+1)=z(n+1)*x(n+1);
+ q=X(n+1)+q;
+end
+disp(q,'X(1)->first DFT coefficient');
+q=0;
+w=%pi;
+n=0:3;
+z=(exp(-%i*w*n));
+for n=0:3
+ X(n+1)=z(n+1)*x(n+1);
+ q=X(n+1)+q;
+end
+disp(ceil(q),'X(2)->second DFT coefficient');
+q=0;
+w=3*%pi/2;
+n=0:3;
+z=(exp(-%i*w*n));
+for n=0:3
+ X(n+1)=z(n+1)*x(n+1);
+ q=X(n+1)+q;
+end
+disp(q,'X(3)->third DFT coefficient');
diff --git a/1592/CH5/EX5.18/Example_5_18.sce b/1592/CH5/EX5.18/Example_5_18.sce new file mode 100755 index 000000000..5d5e132fe --- /dev/null +++ b/1592/CH5/EX5.18/Example_5_18.sce @@ -0,0 +1,8 @@ +//Scilab Code for Example 5.18 of Signals and systems by
+//P.Ramakrishna Rao
+//Given signal x(n)
+clear;
+clc;
+x=[1,2,3,4];
+X=fft(x);
+disp(X,'FFT of given signal is:X(0)-->X(3)')
diff --git a/1592/CH5/EX5.2/Example5_2.sce b/1592/CH5/EX5.2/Example5_2.sce new file mode 100755 index 000000000..abb092a35 --- /dev/null +++ b/1592/CH5/EX5.2/Example5_2.sce @@ -0,0 +1,39 @@ +//Scilab Code for Example 5.2of Signals and systems by
+//P.Ramakrishna Rao
+//Discrete Time Fourier Transform of
+//x[n]= 1 , 0=<n<=3
+clear;
+clc;
+close;
+// DTS Signal
+N1 = 3;
+n = 0:N1;
+x = ones(1,length(n));
+// Discrete-time Fourier Transform
+Wmax = 2*%pi;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = x* exp(-sqrt(-1)*n'*W);
+XW_Mag = real(XW);
+[XW_Phase,db] = phasemag(XW);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+XW_Phase = [-mtlb_fliplr(XW_Phase),XW_Phase(2:1001)];
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',n,x);
+xtitle('Discrete Time Sequence x[n]')
+figure(1);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,abs(XW_Mag));
+title('Discrete Time Fourier Transform X(exp(jW))')
+figure(2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW_Phase);
+title('Phase Response <(X(jW))')
diff --git a/1592/CH5/EX5.2/Fig5_2_2.jpg b/1592/CH5/EX5.2/Fig5_2_2.jpg Binary files differnew file mode 100755 index 000000000..83448475d --- /dev/null +++ b/1592/CH5/EX5.2/Fig5_2_2.jpg diff --git a/1592/CH5/EX5.2/Fig5_2_3.jpg b/1592/CH5/EX5.2/Fig5_2_3.jpg Binary files differnew file mode 100755 index 000000000..6740e0abd --- /dev/null +++ b/1592/CH5/EX5.2/Fig5_2_3.jpg diff --git a/1592/CH5/EX5.3/Example5_3.sce b/1592/CH5/EX5.3/Example5_3.sce new file mode 100755 index 000000000..b5b44b47c --- /dev/null +++ b/1592/CH5/EX5.3/Example5_3.sce @@ -0,0 +1,22 @@ +//Scilab Code for Example 5.3 of Signals and systems by
+//P.Ramakrishna Rao
+clear;
+clc;
+//Inverse Fourier Transform
+w=-20:20;
+X=4*(cos(w))^2;
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(w,X);
+title("X(e^jw)");
+xlabel("Frequency in Radians/sec");
+figure(1);
+n=-50:50;
+x=2*sinc(n)+sinc(n+2)+sinc(n-2);
+a = gca ();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3(n,x);
+title("x(n)");
+xlabel("Time in sec");
diff --git a/1592/CH5/EX5.3/Fig5_3_1.jpg b/1592/CH5/EX5.3/Fig5_3_1.jpg Binary files differnew file mode 100755 index 000000000..a0fd88465 --- /dev/null +++ b/1592/CH5/EX5.3/Fig5_3_1.jpg diff --git a/1592/CH5/EX5.3/Fig5_3_2.jpg b/1592/CH5/EX5.3/Fig5_3_2.jpg Binary files differnew file mode 100755 index 000000000..6e4c15763 --- /dev/null +++ b/1592/CH5/EX5.3/Fig5_3_2.jpg diff --git a/1592/CH5/EX5.4/Example5_4.sce b/1592/CH5/EX5.4/Example5_4.sce new file mode 100755 index 000000000..5fe0e1611 --- /dev/null +++ b/1592/CH5/EX5.4/Example5_4.sce @@ -0,0 +1,33 @@ +//Scilab Code for Example 5.4 of Signals and systems by
+//P.Ramakrishna Rao
+//Discrete Time Fourier Transform of
+// X(e^j*w)=2*%pi*delta(w)
+clear;
+clc;
+close;
+N = 1;
+N1 = -3*N:3*N;
+xn = [zeros(1,N-1),1];
+x = [1 xn xn xn xn xn xn];
+ak = 1/N;
+XW = 2*%pi*ak*ones(1,2*N);
+Wo = 2*%pi/N;
+n = -N:N-1;
+W = Wo*n;
+a = gca();
+a.y_location ="middle";
+a.x_location ="origin";
+plot2d3('gnn',W,XW,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel('W');
+title('DTFT of Periodic Impulse Train')
+figure(1);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',N1,x,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel('n');
+title('Periodic Impulse Train x(n)')
diff --git a/1592/CH5/EX5.4/Fig5_4_1.jpg b/1592/CH5/EX5.4/Fig5_4_1.jpg Binary files differnew file mode 100755 index 000000000..1b790e0d3 --- /dev/null +++ b/1592/CH5/EX5.4/Fig5_4_1.jpg diff --git a/1592/CH5/EX5.4/Fig5_4_2.jpg b/1592/CH5/EX5.4/Fig5_4_2.jpg Binary files differnew file mode 100755 index 000000000..2f8bcc20e --- /dev/null +++ b/1592/CH5/EX5.4/Fig5_4_2.jpg diff --git a/1592/CH5/EX5.5/Example5_5.sce b/1592/CH5/EX5.5/Example5_5.sce new file mode 100755 index 000000000..21023302d --- /dev/null +++ b/1592/CH5/EX5.5/Example5_5.sce @@ -0,0 +1,22 @@ +//Scilab Code for Example 5.5 of Signals and systems by
+//P.Ramakrishna Rao
+clear;
+clc;
+x=[1,2,3,2,1];
+q=0;
+for n=1:5
+ q=x(n)+q;
+end
+disp(q,'(a) X(e^j*0)');
+q=0;
+for n=-2:2
+ q=((-1)^n)*x(n+3)+q;
+end
+disp(q,'(c) X(e^j*pi)');
+disp('(d) X(e^j*pi)=2*pi*x(0)');
+disp(2*%pi*x(3));
+q=0;
+for n=-2:2
+ q=(x(n+3))^2+q;
+end
+disp(q*2*%pi,'(e) |X(e^j*w)|^2');
diff --git a/1592/CH5/EX5.9.i/Example5_9_i.sce b/1592/CH5/EX5.9.i/Example5_9_i.sce new file mode 100755 index 000000000..27f2ce0b9 --- /dev/null +++ b/1592/CH5/EX5.9.i/Example5_9_i.sce @@ -0,0 +1,23 @@ +//Scilab Code for Example 5.9(i) of Signals and systems by
+//P.Ramakrishna Rao
+clc;
+clear;
+q=0;
+a1=0.5
+a2=-0.5;
+n=1:101;
+x1=a1^n;
+x2=a2^n;
+w=2;
+n=0:100;
+z=(exp(-%i*w*n));
+for n=0:33;
+ X(n+1)=z(n+1)*x1(3*n+1);
+ q=X(n+1)+q;
+end
+disp(q,'Y1(e^2j) at a=0.5');
+for n=0:33;
+ X(n+1)=z(n+1)*x2(3*n+1);
+ q=X(n+1)+q;
+end
+disp(q,'Y1(e^2j) at a=-0.5');
diff --git a/1592/CH5/EX5.9.ii/Example_5_9_ii.sce b/1592/CH5/EX5.9.ii/Example_5_9_ii.sce new file mode 100755 index 000000000..ed3eaf304 --- /dev/null +++ b/1592/CH5/EX5.9.ii/Example_5_9_ii.sce @@ -0,0 +1,23 @@ +//Scilab Code for Example 5.9(ii) of Signals and systems by
+//P.Ramakrishna Rao
+clc;
+clear;
+q=0;
+a1=0.5
+a2=-0.5;
+n=1:101;
+x1=a1^n;
+x2=a2^n;
+w=2;
+n=0:100;
+z=(exp(-%i*w*n));
+for n=0:33;
+ X(n+1)=z(n+1)*x1(n+1);
+ q=X(n+1)+q;
+end
+disp(q,'Y2(e^2j) at a=0.5');
+for n=0:33;
+ X(n+1)=z(n+1)*x2(n+1);
+ q=X(n+1)+q;
+end
+disp(q,'Y2(e^2j) at a=-0.5');
diff --git a/1592/CH5/EX5.9.iii/Example_5_9_iii.sce b/1592/CH5/EX5.9.iii/Example_5_9_iii.sce new file mode 100755 index 000000000..0b532366b --- /dev/null +++ b/1592/CH5/EX5.9.iii/Example_5_9_iii.sce @@ -0,0 +1,23 @@ +//Scilab Code for Example 5.9(iii) of Signals and systems by
+//P.Ramakrishna Rao
+clc;
+clear;
+q=0;
+a1=0.5
+a2=-0.5;
+n=1:101;
+x1=a1^n;
+x2=a2^n;
+w=2;
+n=0:100;
+z=(exp(-%i*w*n));
+for n=0:33;
+ X(n+1)=z(n+1)*x1(n+1)*cos(0.4*%pi*n);
+ q=X(n+1)+q;
+end
+disp(q,'Y3(e^2j) at a=0.5');
+for n=0:33;
+ X(n+1)=z(n+1)*x2(n+1)*cos(0.4*%pi*n);
+ q=X(n+1)+q;
+end
+disp(q,'Y3(e^2j) at a=-0.5');
|