From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 842/CH1/EX0.15/Example0_15.sce | 15 +++++++++++++ 842/CH1/EX01.13/Example01_13b.sce | 21 +++++++++++++++++++ 842/CH1/EX1.1/Example1_1.sce | 44 +++++++++++++++++++++++++++++++++++++++ 842/CH1/EX1.12/Example1_12.sce | 27 ++++++++++++++++++++++++ 842/CH1/EX1.13/Example1_13.sce | 22 ++++++++++++++++++++ 842/CH1/EX1.14/Example1_14.sce | 21 +++++++++++++++++++ 842/CH1/EX1.15/Example1_15.sce | 21 +++++++++++++++++++ 842/CH1/EX1.16/Example1_16.sce | 22 ++++++++++++++++++++ 842/CH1/EX1.17/Example1_17.sce | 37 ++++++++++++++++++++++++++++++++ 842/CH1/EX1.18/Example1_18.sce | 37 ++++++++++++++++++++++++++++++++ 842/CH1/EX1.2/Example1_2.sce | 23 ++++++++++++++++++++ 842/CH1/EX1.20/Example1_20.sce | 37 ++++++++++++++++++++++++++++++++ 842/CH1/EX1.3/Example1_3.sce | 25 ++++++++++++++++++++++ 842/CH1/EX1.4/Example1_4.sce | 18 ++++++++++++++++ 842/CH1/EX1.6/Example1_6.sce | 33 +++++++++++++++++++++++++++++ 15 files changed, 403 insertions(+) create mode 100755 842/CH1/EX0.15/Example0_15.sce create mode 100755 842/CH1/EX01.13/Example01_13b.sce create mode 100755 842/CH1/EX1.1/Example1_1.sce create mode 100755 842/CH1/EX1.12/Example1_12.sce create mode 100755 842/CH1/EX1.13/Example1_13.sce create mode 100755 842/CH1/EX1.14/Example1_14.sce create mode 100755 842/CH1/EX1.15/Example1_15.sce create mode 100755 842/CH1/EX1.16/Example1_16.sce create mode 100755 842/CH1/EX1.17/Example1_17.sce create mode 100755 842/CH1/EX1.18/Example1_18.sce create mode 100755 842/CH1/EX1.2/Example1_2.sce create mode 100755 842/CH1/EX1.20/Example1_20.sce create mode 100755 842/CH1/EX1.3/Example1_3.sce create mode 100755 842/CH1/EX1.4/Example1_4.sce create mode 100755 842/CH1/EX1.6/Example1_6.sce (limited to '842/CH1') diff --git a/842/CH1/EX0.15/Example0_15.sce b/842/CH1/EX0.15/Example0_15.sce new file mode 100755 index 000000000..4d018c34e --- /dev/null +++ b/842/CH1/EX0.15/Example0_15.sce @@ -0,0 +1,15 @@ +//clear// +//Example 1.5:To express sum of two complex exponentials +//as a single sinusoid +clear; +clc; +close; +t =0:1/100:2*%pi; +x1 = exp(sqrt(-1)*2*t); +x2 = exp(sqrt(-1)*3*t); +x = x1+x2; +for i = 1:length(x) + X(i) = sqrt((real(x(i)).^2)+(imag(x(i)).^2)); +end +plot(t,X); +xtitle('Full wave rectified sinusoid','time t','Magnitude'); diff --git a/842/CH1/EX01.13/Example01_13b.sce b/842/CH1/EX01.13/Example01_13b.sce new file mode 100755 index 000000000..846653d10 --- /dev/null +++ b/842/CH1/EX01.13/Example01_13b.sce @@ -0,0 +1,21 @@ +//clear// +//Example 1.13(b):Determination of stability of a given system +//Page 50 +//given system y(t) = exp(x(t)) +clear; +clc; +Maximum_Limit = 10; +S = 0; +for t = 0:Maximum_Limit-1 + x(t+1)= -2^t; //Input some bounded value + S = S+exp(x(t+1)); +end +if (S >Maximum_Limit) + disp('Eventhough input is bounded output is unbounded') + disp('The given system is unstable'); + disp('S ='); + S + else + disp('The given system is stable'); + disp(S); +end diff --git a/842/CH1/EX1.1/Example1_1.sce b/842/CH1/EX1.1/Example1_1.sce new file mode 100755 index 000000000..8026ecf5d --- /dev/null +++ b/842/CH1/EX1.1/Example1_1.sce @@ -0,0 +1,44 @@ +//clear// +//Example 1.1: Time Shifting +//SIGNALS & SYSTEMS, Second Edition +//V.OPPENHEIM, S.WILLSKY, S.HAMID NAMWAB +//PHI, 2008 Edition +//Page 10 +clear; +clc; +close; +t = 0:1/100:1; +for i = 1:length(t) + x(i) = 1 ; +end +for i = length(t)+1:2*length(t) + x(i) = 1-t(i-length(t)); +end +t1 = 0:1/100:2; +t2 = -1:1/100:1; +//t3 = 0:1/100:4/3; +//t4 = 0:1/length(t3):1; +//Mid =ceil(length(t3)/2); +//for i = 1:Mid +// x3(i) = 1 ; +//end +//for i = Mid+1:length(t3) +// x3(i) = 1-t4(i-Mid); +//end +figure +a=gca(); +plot2d(t1,x(1:$-1)) +a.thickness=2; +xtitle('The signal x(t)') +figure +a=gca(); +plot2d(t2,x(1:$-1)) +a.thickness=2; +a.y_location = "middle"; +xtitle('The signal x(t+1)') +figure +a=gca(); +plot2d(t2,x($:-1:2)) +a.thickness=2; +a.y_location = "middle"; +xtitle('The signal x(-t+1)') diff --git a/842/CH1/EX1.12/Example1_12.sce b/842/CH1/EX1.12/Example1_12.sce new file mode 100755 index 000000000..7ba769fd7 --- /dev/null +++ b/842/CH1/EX1.12/Example1_12.sce @@ -0,0 +1,27 @@ +//clear// +//Example 1.12:Classification of system:Causality property +//Page 47 +//To check whether the given discrete system is a Causal System (or) Non-Causal System +//Given discrete system y[n]= x[-n] +clear; +clc; +x = [2,4,6,8,10,0,0,0,1]; //Assign some value to input +n = -length(x)/2:length(x)/2; +count = 0; +mid = ceil(length(x)/2); +y = zeros(1,length(x)); +y(mid+1:$) = x($:-1:mid+1); +for n = -1:-1:-mid + y(n+1+mid) = x(-n); +end +for i = 1:length(x) + if (y(i)==x(i)) + count = count+1; + end +end +if (count==length(x)) + disp('The given system is a causal system') +else + disp('Since it depends on future input value') + disp('The given system is a non-causal system') +end diff --git a/842/CH1/EX1.13/Example1_13.sce b/842/CH1/EX1.13/Example1_13.sce new file mode 100755 index 000000000..bb0ca7c5b --- /dev/null +++ b/842/CH1/EX1.13/Example1_13.sce @@ -0,0 +1,22 @@ +//clear// +//Example 1.13:Determination of stablility of a given system +//Page 49 +//given system y(t) = t.x(t) +clear; +clc; +x = [1,2,3,4,0,2,1,3,5,8]; //Assign some input +Maximum_Limit = 10; +S = 0; +for t = 0:Maximum_Limit-1 + S = S+t*x(t+1); +end +if (S >Maximum_Limit) + disp('Eventhough input is bounded output is unbounded') + disp('The given system is unstable'); + disp('S ='); + S + else + disp('The given system is stable'); + disp('The value of S ='); + S +end diff --git a/842/CH1/EX1.14/Example1_14.sce b/842/CH1/EX1.14/Example1_14.sce new file mode 100755 index 000000000..01e5094b1 --- /dev/null +++ b/842/CH1/EX1.14/Example1_14.sce @@ -0,0 +1,21 @@ +//clear// +//Example 1.14:classification of a system:Time Invariance Property +//Page 51 +//To check whether the given system is a Time variant (or) Time In-variant +// The given discrete signal is y(t) = sin(x(t)) +clear; +clc; +to = 2; //Assume the amount of time shift =2 +T = 10; //Length of given signal +for t = 1:T + x(t) = (2*%pi/T)*t; + y(t) = sin(x(t)); +end +//First shift the input signal only +Input_shift = sin(x(T-to)); +Output_shift = y(T-to); +if(Input_shift == Output_shift) + disp('The given discrete system is a Time In-variant system'); +else + disp('The given discrete system is a Time Variant system'); +end diff --git a/842/CH1/EX1.15/Example1_15.sce b/842/CH1/EX1.15/Example1_15.sce new file mode 100755 index 000000000..3fe295692 --- /dev/null +++ b/842/CH1/EX1.15/Example1_15.sce @@ -0,0 +1,21 @@ +//clear// +//Example 1.15:Classification of a System:Time Invariance Property +//Page 51 +//To check whether the given system is a Time variant (or) Time In-variant +// The given discrete signal is y[n] = n.x[n] +clear; +clc; +no = 2; //Assume the amount of time shift =2 +L = 10; //Length of given signal +for n = 1:L + x(n) = n; + y(n) = n*x(n); +end +//First shift the input signal only +Input_shift = x(L-no); +Output_shift = y(L-no); +if(Input_shift == Output_shift) + disp('The given discrete system is a Time In-variant system'); +else + disp('The given discrete system is a Time Variant system'); +end diff --git a/842/CH1/EX1.16/Example1_16.sce b/842/CH1/EX1.16/Example1_16.sce new file mode 100755 index 000000000..1fcbfd98d --- /dev/null +++ b/842/CH1/EX1.16/Example1_16.sce @@ -0,0 +1,22 @@ +//clear// +//Example 1.16:Classification of system:Time Invariance Property +//Page 52 +//To check whether the given system is a Time variant (or) Time In-variant +// The given discrete signal is y(t) = x(2t) +clear; +clc; +to = 2; //Assume the amount of time shift =2 +T = 10; //Length of given signal +x = [1,2,3,4,5,6,7,8,9,10]; +y = zeros(1,length(x)); +for t = 1:length(x)/2 + y(t) = x(2*t); +end +//First shift the input signal only +Input_shift = x(T-to); +Output_shift = y(T-to); +if(Input_shift == Output_shift) + disp('The given discrete system is a Time In-variant system'); +else + disp('The given discrete system is a Time Variant system'); +end diff --git a/842/CH1/EX1.17/Example1_17.sce b/842/CH1/EX1.17/Example1_17.sce new file mode 100755 index 000000000..7e40a63fe --- /dev/null +++ b/842/CH1/EX1.17/Example1_17.sce @@ -0,0 +1,37 @@ +//clear// +//Example 1.17:Classification of system:Linearity Property +//Page 54 +//To check whether the given discrete system is a Linear System (or) Non-Linear System +//Given discrete system y(t)= t*x(t) +clear; +clc; +x1 = [1,1,1,1]; +x2 = [2,2,2,2]; +a = 1; +b = 1; +for t = 1:length(x1) + x3(t) = a*x1(t)+b*x2(t); +end +for t = 1:length(x1) + y1(t) = t*x1(t); + y2(t) = t*x2(t); + y3(t) = t*x3(t); +end +for t = 1:length(y1) + z(t) = a*y1(t)+b*y2(t); +end +count = 0; +for n =1:length(y1) + if(y3(t)== z(t)) + count = count+1; + end +end +if(count == length(y3)) + disp('Since It satisifies the superposition principle') + disp('The given system is a Linear system') + y3 + z + else + disp('Since It does not satisify the superposition principle') + disp('The given system is a Non-Linear system') +end diff --git a/842/CH1/EX1.18/Example1_18.sce b/842/CH1/EX1.18/Example1_18.sce new file mode 100755 index 000000000..6b5e9e280 --- /dev/null +++ b/842/CH1/EX1.18/Example1_18.sce @@ -0,0 +1,37 @@ +//clear// +//Example 1.18:Classsification of a system:Linearity Property +//Page 54 +//To check whether the given discrete system is a Linear System (or) Non-Linear System +//Given discrete system y(t)= (x(t)^2) +clear; +clc; +x1 = [1,1,1,1]; +x2 = [2,2,2,2]; +a = 1; +b = 1; +for t = 1:length(x1) + x3(t) = a*x1(t)+b*x2(t); +end +for t = 1:length(x1) + y1(t) = (x1(t)^2); + y2(t) = (x2(t)^2); + y3(t) = (x3(t)^2); +end +for t = 1:length(y1) + z(t) = a*y1(t)+b*y2(t); +end +count = 0; +for n =1:length(y1) + if(y3(t)== z(t)) + count = count+1; + end +end +if(count == length(y3)) + disp('Since It satisifies the superposition principle') + disp('The given system is a Linear system') + y3 + z + else + disp('Since It does not satisify the superposition principle') + disp('The given system is a Non-Linear system') +end diff --git a/842/CH1/EX1.2/Example1_2.sce b/842/CH1/EX1.2/Example1_2.sce new file mode 100755 index 000000000..597370f3d --- /dev/null +++ b/842/CH1/EX1.2/Example1_2.sce @@ -0,0 +1,23 @@ +//clear// +//Example 1.2:Time Scaling +//SIGNALS & SYSTEMS, Second Edition +//V.OPPENHEIM, S.WILLSKY, S.HAMID NAMWAB +//PHI, 2008 Edition +//Page 11 +clear; +clc; +close; +t3 = 0:1/100:4/3; +t4 = 0:1/length(t3):1; +Mid =ceil(length(t3)/2); +for i = 1:Mid + x3(i) = 1 ; +end +for i = Mid+1:length(t3) + x3(i) = 1-t4(i-Mid); +end +figure +a=gca(); +plot2d(t3,x3) +a.thickness=2; +xtitle('Time Scaling x(3t/2)') diff --git a/842/CH1/EX1.20/Example1_20.sce b/842/CH1/EX1.20/Example1_20.sce new file mode 100755 index 000000000..6ed3e4665 --- /dev/null +++ b/842/CH1/EX1.20/Example1_20.sce @@ -0,0 +1,37 @@ +//clear// +//Example 1.20:Classsification of a system:Linearity Property +//Page 55 +//To check whether the given discrete system is a Linear System (or) Non-Linear System +//Given discrete system y[n])= 2*x[n]+3 +clear; +clc; +x1 = [1,1,1,1]; +x2 = [2,2,2,2]; +a = 1; +b = 1; +for n = 1:length(x1) + x3(n) = a*x1(n)+b*x2(n); +end +for n = 1:length(x1) + y1(n) = 2*x1(n)+3; + y2(n) = 2*x2(n)+3; + y3(n) = 2*x3(n)+3; +end +for n = 1:length(y1) + z(n) = a*y1(n)+b*y2(n); +end +count = 0; +for n =1:length(y1) + if(y3(n)== z(n)) + count = count+1; + end +end +if(count == length(y3)) + disp('Since It satisifies the superposition principle') + disp('The given system is a Linear system') + y3 + z + else + disp('Since It does not satisify the superposition principle') + disp('The given system is a Non-Linear system') +end diff --git a/842/CH1/EX1.3/Example1_3.sce b/842/CH1/EX1.3/Example1_3.sce new file mode 100755 index 000000000..41e4f2592 --- /dev/null +++ b/842/CH1/EX1.3/Example1_3.sce @@ -0,0 +1,25 @@ +//clear// +//Example 1.3:Time Scaling and Time Shifting +//SIGNALS & SYSTEMS, Second Edition +//V.OPPENHEIM, S.WILLSKY, S.HAMID NAMWAB +//PHI, 2008 Edition +//Page 11 +clear; +clc; +close; +t3 = 0:1/100:4/3; +t4 = 0:1/length(t3):1; +Mid =ceil(length(t3)/2); +for i = 1:Mid + x3(i) = 1 ; +end +for i = Mid+1:length(t3) + x3(i) = 1-t4(i-Mid); +end +t5 = -2/3:1/100:2/3; +figure +a=gca(); +plot2d(t5,x3) +a.thickness=2; +a.y_location ="middle"; +xtitle('Time Scaling and Time Shifting x((3t/2)+1)') diff --git a/842/CH1/EX1.4/Example1_4.sce b/842/CH1/EX1.4/Example1_4.sce new file mode 100755 index 000000000..0dcff04d1 --- /dev/null +++ b/842/CH1/EX1.4/Example1_4.sce @@ -0,0 +1,18 @@ +//clear// +//Example 1.4:Combinationation two periodic signals +// Aperiodic signal +//Page 12 +clear; +clc; +close; +F=1; //Frequency = 1 Hz +t1 = 0:-1/100:-2*%pi; +x1 = cos(F*t1); +t2 = 0:1/100:2*%pi; +x2 = sin(F*t2); +a=gca(); +plot(t2,x2); +plot(t1,x1); +a.y_location = "middle"; +a.x_location = "middle"; +xtitle('The signal x(t) = cost for t < 0 and sint for t > 0: Aperiodic Signal') diff --git a/842/CH1/EX1.6/Example1_6.sce b/842/CH1/EX1.6/Example1_6.sce new file mode 100755 index 000000000..a539fee43 --- /dev/null +++ b/842/CH1/EX1.6/Example1_6.sce @@ -0,0 +1,33 @@ +//clear// +//Example 1.6:Determine the fundamental period of composite +// discrete time signal +//x[n] = exp(j(2*%pi/3)n)+exp(j(3*%pi/4)n) +clear; +clc; +close; +Omega1 = 2*%pi/3; //Angular frequency signal 1 +Omega2 = 3*%pi/4; //Angular frequency signal 2 +N1 = (2*%pi)/Omega1; //Peirod of signal 1 +N2 = (2*%pi)/Omega2; //Period of signal 2 +//To find rational period of signal 1 +for m1 = 1:100 + period = N1*m1; + if(modulo(period,1)==0) + period1 = period; + integer_value = m1 + break; + end +end +//To find rational period of signal 2 +for m2 = 1:100 + period = N2*m2; + if(modulo(period,1)==0) + period2 = period; + integer_value = m2 + break; + end +end +disp(period1) +disp(period2) +//To determine the fundamental period N +N = period1*period2 -- cgit