diff options
Diffstat (limited to '22')
164 files changed, 1810 insertions, 0 deletions
diff --git a/22/CH1/EX1.10/ch1ex10.sce b/22/CH1/EX1.10/ch1ex10.sce new file mode 100755 index 000000000..68f3abf9e --- /dev/null +++ b/22/CH1/EX1.10/ch1ex10.sce @@ -0,0 +1,13 @@ +//signals and systems
+//formation of differential equation for a series RC circuit
+clear
+close
+clc
+r=15;
+c=0.2;
+//let the input voltage be x(t)
+//let the loop current be i(t)
+//let capacitor voltage be y(t)
+disp("the loop equation 4 the circuit is given by r*i(t)+(5/D)*i(t)=x(t)")
+disp("final form - (3D+1)y(t)=x(t)")
+//the next few problems are of the same type where we have to frame the eqation based on the scenario
\ No newline at end of file diff --git a/22/CH1/EX1.2/ch1ex2.sce b/22/CH1/EX1.2/ch1ex2.sce new file mode 100755 index 000000000..cac2c6de7 --- /dev/null +++ b/22/CH1/EX1.2/ch1ex2.sce @@ -0,0 +1,17 @@ +//signals and systems
+//power and rms value of a signal
+clear
+close
+clc
+//part a is a periodic function with period 2*pi/w0
+
+disp("consider the power for almost infinite range");
+disp('part (a)')
+disp("integrating ((c*cos(w0*t +theta))^2) for this big range gives c^2/2 as the power which is irrespective of w0");
+disp("rms value is the square root of power and therefpre equal to sqrt(c^2/2)\n\n");
+//part b is the sum of 2 sinusoids
+disp('part (b)')
+disp("again integrating in the same way and ignoring the zero terms we get (c1^2+c2^2)/2");
+//part c deals with a complex signal
+disp('part (c)')
+disp("integrating the expression we get |D|^2 as the power and |D| as the rms value");
diff --git a/22/CH1/EX1.3/ch1ex3.sce b/22/CH1/EX1.3/ch1ex3.sce new file mode 100755 index 000000000..59181a953 --- /dev/null +++ b/22/CH1/EX1.3/ch1ex3.sce @@ -0,0 +1,25 @@ +//signals and systems
+//time shifting
+clear
+close
+clc
+t=[-4:0.001:4];
+a=gca();
+plot(t,(exp(-2*t)).*(t>0))
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t)')
+//delaying the function by 1 second we obtain
+figure
+a=gca();
+plot(t,(exp(-2*(t-1))).*((t>1)))
+a.thickness=2;
+a.y_location="middle";
+title=('the signal x(t-1)')
+//advancing the function by 1 second we obtain
+figure
+a=gca();
+plot(t,(exp(-2*(t+1))).*(t>-1))
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t+1)')
\ No newline at end of file diff --git a/22/CH1/EX1.3/ch1ex3a.jpg b/22/CH1/EX1.3/ch1ex3a.jpg Binary files differnew file mode 100755 index 000000000..a954795ae --- /dev/null +++ b/22/CH1/EX1.3/ch1ex3a.jpg diff --git a/22/CH1/EX1.3/ch1ex3b.jpg b/22/CH1/EX1.3/ch1ex3b.jpg Binary files differnew file mode 100755 index 000000000..9c916f2dc --- /dev/null +++ b/22/CH1/EX1.3/ch1ex3b.jpg diff --git a/22/CH1/EX1.4/ch1ex4.sce b/22/CH1/EX1.4/ch1ex4.sce new file mode 100755 index 000000000..b2e524ce8 --- /dev/null +++ b/22/CH1/EX1.4/ch1ex4.sce @@ -0,0 +1,26 @@ +//signals and systems
+//time scaling
+clear
+close
+clc
+t=[-4:0.1:6];
+a=gca();
+plot(t,2.*((t>-1.5)&(t<=0))+2*exp(-t/2).*((t>0)&(t<=3)));
+figure
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t)');
+//compressing this graph by a factor 3
+a=gca();
+plot(t,2.*((t>-0.5)&(t<=0))+2*exp(-3*t/2).*((t>0)&(t<=1)));
+figure
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(3t)');
+//expanding this signal by a factor 2
+a=gca();
+plot(t,2.*((t>-3)&(t<=0))+2*exp(-t/4).*((t>0)&(t<=6)));
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t/2)');
+//the coordinates can b easily obtained from the graphs
diff --git a/22/CH1/EX1.4/ch1ex4a.jpg b/22/CH1/EX1.4/ch1ex4a.jpg Binary files differnew file mode 100755 index 000000000..49ac99136 --- /dev/null +++ b/22/CH1/EX1.4/ch1ex4a.jpg diff --git a/22/CH1/EX1.4/ch1ex4b.jpg b/22/CH1/EX1.4/ch1ex4b.jpg Binary files differnew file mode 100755 index 000000000..ae5b4deba --- /dev/null +++ b/22/CH1/EX1.4/ch1ex4b.jpg diff --git a/22/CH1/EX1.5/ch1ex5.sce b/22/CH1/EX1.5/ch1ex5.sce new file mode 100755 index 000000000..4ad13879a --- /dev/null +++ b/22/CH1/EX1.5/ch1ex5.sce @@ -0,0 +1,20 @@ +//signals and systems
+//time reversal
+clear
+close
+clc
+t=[-6:0.1:6];
+a=gca();
+plot(t,exp(t/2).*((t>=-5)&(t<=-1)));
+figure
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t)')
+//by replacing t by -t we get
+a=gca();
+plot(t,exp(-t/2).*((t>=1)&(t<5)));
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(-t)')
+//the coordinates can be easily observed from the graphs
+
diff --git a/22/CH1/EX1.5/ch1ex5a.jpg b/22/CH1/EX1.5/ch1ex5a.jpg Binary files differnew file mode 100755 index 000000000..b4b125b5b --- /dev/null +++ b/22/CH1/EX1.5/ch1ex5a.jpg diff --git a/22/CH1/EX1.5/ch5ex5b.jpg b/22/CH1/EX1.5/ch5ex5b.jpg Binary files differnew file mode 100755 index 000000000..49eb47326 --- /dev/null +++ b/22/CH1/EX1.5/ch5ex5b.jpg diff --git a/22/CH1/EX1.6/ch1ex6.jpg b/22/CH1/EX1.6/ch1ex6.jpg Binary files differnew file mode 100755 index 000000000..800f442ec --- /dev/null +++ b/22/CH1/EX1.6/ch1ex6.jpg diff --git a/22/CH1/EX1.6/ch1ex6.sce b/22/CH1/EX1.6/ch1ex6.sce new file mode 100755 index 000000000..9a37f4298 --- /dev/null +++ b/22/CH1/EX1.6/ch1ex6.sce @@ -0,0 +1,13 @@ +//signals and systems
+//representation of a signal
+clear
+close
+clc
+t=[0:0.1:5];
+a=gca();
+plot(t,t.*((t>=0)&(t<=2)) - 2*(t-3).*((t>2)&(t<=3)));
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t)')
+//this can be written as a combination of 2 lines
+disp("x(t)=x1(t)+x2(t)= tu(t)-3(t-2)u(t-2)+2(t-3)u(t-3)");
diff --git a/22/CH1/EX1.7/ch1ex7.jpg b/22/CH1/EX1.7/ch1ex7.jpg Binary files differnew file mode 100755 index 000000000..09bac318c --- /dev/null +++ b/22/CH1/EX1.7/ch1ex7.jpg diff --git a/22/CH1/EX1.7/ch1ex7.sce b/22/CH1/EX1.7/ch1ex7.sce new file mode 100755 index 000000000..2f3cb6441 --- /dev/null +++ b/22/CH1/EX1.7/ch1ex7.sce @@ -0,0 +1,13 @@ +//signals and systems
+//representation of a signal
+clear
+close
+clc
+t=[-2:0.1:5];
+a=gca();
+plot(t,2.*((t>=-1.5)&(t<0))+2*exp(-t/2).*((t>=0)&(t<3)));
+a.thickness=2;
+a.y_location="middle";
+xtitle=('the signal x(t-1)')
+//this is a cobination of a constant function and an exponential function
+disp("x(t)=x1(t)+x2(t)= 2u(t+1.5)-2(1-exp(-t/2))u(t)-2exp(-t/2)u(t-3)");
diff --git a/22/CH1/EX1.8/ch1ex8.sce b/22/CH1/EX1.8/ch1ex8.sce new file mode 100755 index 000000000..2e9cc0013 --- /dev/null +++ b/22/CH1/EX1.8/ch1ex8.sce @@ -0,0 +1,20 @@ +//signals and systems
+//odd and even components
+clear
+close
+clc
+t = 0:1/100:5;
+x=exp(%i.*t);
+y=exp(-%i.*t);
+even=x./2+y./2;
+odd=x./2-y./2;
+figure
+a=gca();
+plot2d(t,even)
+a.x_location='origin'
+xtitle=('even')
+figure
+a=gca();
+plot2d(t,odd./%i)
+a.x_location='origin'
+xtitle=('odd')
\ No newline at end of file diff --git a/22/CH1/EX1.8/ch1ex8a.jpg b/22/CH1/EX1.8/ch1ex8a.jpg Binary files differnew file mode 100755 index 000000000..2583a1d90 --- /dev/null +++ b/22/CH1/EX1.8/ch1ex8a.jpg diff --git a/22/CH1/EX1.8/ch1ex8b.jpg b/22/CH1/EX1.8/ch1ex8b.jpg Binary files differnew file mode 100755 index 000000000..543e20901 --- /dev/null +++ b/22/CH1/EX1.8/ch1ex8b.jpg diff --git a/22/CH10/EX10.10/ch10ex10.sce b/22/CH10/EX10.10/ch10ex10.sce new file mode 100755 index 000000000..ef4197be5 --- /dev/null +++ b/22/CH10/EX10.10/ch10ex10.sce @@ -0,0 +1,7 @@ +A=[0 1;-2 -3];
+[V,lambda]=spec(A);
+B=[1;2];
+Bhat=P*B
+disp(P,"P=")
+disp(Bhat,"B^=")
+disp(lambda,"lambda=")
\ No newline at end of file diff --git a/22/CH10/EX10.11/ch10ex11.sce b/22/CH10/EX10.11/ch10ex11.sce new file mode 100755 index 000000000..d76c41e3a --- /dev/null +++ b/22/CH10/EX10.11/ch10ex11.sce @@ -0,0 +1,20 @@ +A=[1 0;1 -1];
+[V,lambda]=spec(A);
+B=[1;0];
+C=[1 -2];
+P=inv(V);
+Bhat=P*B
+Chat=C*inv(P)
+disp(' (a):')
+disp(Bhat,"B^=")
+disp(Chat,"C^=")
+A=[-1 0;-2 1];
+[V,lambda]=spec(A);
+B=[1;1];
+C=[0 1];
+P=inv(V);
+Bhat=P*B
+Chat=C*inv(P)
+disp('Part (b):')
+disp(Bhat,"B^=")
+disp(Chat,"c^=")
\ No newline at end of file diff --git a/22/CH10/EX10.12/ch10ex12.sce b/22/CH10/EX10.12/ch10ex12.sce new file mode 100755 index 000000000..90ae0bd8f --- /dev/null +++ b/22/CH10/EX10.12/ch10ex12.sce @@ -0,0 +1,11 @@ +A=[0 1;-1/6 5/6];
+B=[0;1];
+C=[-1 5];
+D=0;
+sys=syslin('d',A,B,C,D);
+N=25;
+x=ones(1,N+1);n=(0:N);
+q0=[2;3];
+[ y q]=csim('step',n,sys);
+y=dsimul(sys,x);
+plot2d3(y)
\ No newline at end of file diff --git a/22/CH10/EX10.13/ch10ex13.sce b/22/CH10/EX10.13/ch10ex13.sce new file mode 100755 index 000000000..e90eab3dd --- /dev/null +++ b/22/CH10/EX10.13/ch10ex13.sce @@ -0,0 +1,18 @@ +//LTi Systems characterized by Linear Constant
+//Inverse Z Transform
+//z = %z;
+syms n z;
+H1 = (-2*z)/(z-(1/3));
+H2 = (3*z)/(z-0.5);
+H3 = (24*z)/(z-1);
+F1 = H1*z^(n-1)*(z-(1/3));
+F2 = H2*z^(n-1)*(z-0.5);
+F3 = H3*z^(n-1)*(z-1);
+h1 = limit(F1,z,(1/3));
+disp(h1,'h1[n]=')
+h2 = limit(F2,z,0.5);
+disp(h2,'h2[n]=')
+h3 = limit(F3,z,1);
+disp(h3,'h3[n]=')
+h = h1+h2+h3;
+disp(h,'h[n]=')
\ No newline at end of file diff --git a/22/CH10/EX10.4/ch10ex4.sce b/22/CH10/EX10.4/ch10ex4.sce new file mode 100755 index 000000000..d429c2a27 --- /dev/null +++ b/22/CH10/EX10.4/ch10ex4.sce @@ -0,0 +1,11 @@ +//signals and systems
+//state space analysis
+//state space description
+clear;
+close;
+clc;
+s=poly(0,'s');
+H=[(4/3)/(1+s),-2/(3+s), (2/3)/(4+s)];
+Sys=tf2ss(H)
+clean(ss2tf(Sys))
+disp(Sys)
\ No newline at end of file diff --git a/22/CH10/EX10.5/ch10ex5.sce b/22/CH10/EX10.5/ch10ex5.sce new file mode 100755 index 000000000..dfc060e14 --- /dev/null +++ b/22/CH10/EX10.5/ch10ex5.sce @@ -0,0 +1,9 @@ +syms t s
+A=[-12 2/3;-36 -1]; B=[1/3;1]; q0=[2;1]; X=1/s;
+size(A)
+size(s*eye(2,2))
+Q=inv(s*eye(2,2)-A)*(q0+B*X);
+q=[];
+q(1)=ilaplace(Q(1));
+q(2)=ilaplace(Q(2));
+disp(q*'u(t)',"[q1(t) ; q2(t)]")
\ No newline at end of file diff --git a/22/CH10/EX10.6/ch10ex6.sce b/22/CH10/EX10.6/ch10ex6.sce new file mode 100755 index 000000000..a3a323162 --- /dev/null +++ b/22/CH10/EX10.6/ch10ex6.sce @@ -0,0 +1,8 @@ +A=[0 1;-2 -3];
+B=[1 0;1 1];
+C=[1 0;1 1;0 2];
+D=[0 0;1 0; 0 1];
+syms s;
+H=C*inv(s*eye(2,2)-A)*B+D;
+disp(H,"the transfer function matrix H(s)=")
+disp(H(3,2),"the transfer function relating y3 and x2 is H32(s)=")
diff --git a/22/CH10/EX10.7/ch10ex7.sce b/22/CH10/EX10.7/ch10ex7.sce new file mode 100755 index 000000000..6306c0f88 --- /dev/null +++ b/22/CH10/EX10.7/ch10ex7.sce @@ -0,0 +1,19 @@ +//signals and systems
+//state space
+//time domain method to find the state vector
+clc;
+clf;
+s=poly(0,'s');
+A=[s+12 -2/3; 36 s+1];
+y=roots(det(A))
+t=poly(0,'t');
+beta=inv([1 y(1); 1 y(2)])*[%e^-y(1)*t; %e^-y(2)*t];
+disp(beta)
+size(beta)
+W=beta(1)*[1 0;0 1]+ beta(2)*[-12 2/3;-36 -1];
+zir=W*[2;1];
+disp(zir);
+zsr=W*[1/3;1];
+disp(zsr);
+total=zir+zsr;
+disp(total);
diff --git a/22/CH10/EX10.8/ch10ex8.sce b/22/CH10/EX10.8/ch10ex8.sce new file mode 100755 index 000000000..798a82422 --- /dev/null +++ b/22/CH10/EX10.8/ch10ex8.sce @@ -0,0 +1,11 @@ +syms t s;
+F1=ilaplace((s+3)/((s+1)*(s+2)))
+F2=ilaplace(1/((s+1)*(s+2)))
+F3=ilaplace(-2/((s+1)*(s+2)))
+F4=ilaplace(s/((s+1)*(s+2)))
+F=[F1 F2;F3 F4];
+disp(F,"f(t)=")
+A=[1 0;1 1;0 2];
+B=[0 0;1 0;0 1];
+h=A*F*[1 0;1 1]+B*eye(2,2);//here 1 represents del(t)
+disp(h,"h(t)=")
\ No newline at end of file diff --git a/22/CH10/EX10.9/ch10ex9.sce b/22/CH10/EX10.9/ch10ex9.sce new file mode 100755 index 000000000..08852ffe6 --- /dev/null +++ b/22/CH10/EX10.9/ch10ex9.sce @@ -0,0 +1,7 @@ +A=[0 1;-2 -3];
+B=[1;2];
+P=[1 1;1 -1];
+Ahat= P*A*inv(P)
+Bhat=P*B
+disp(Ahat,"A^=")
+disp(Bhat,"B^=")
diff --git a/22/CH2/EX2.5/ch2ex5b.jpg b/22/CH2/EX2.5/ch2ex5b.jpg Binary files differnew file mode 100755 index 000000000..137e91516 --- /dev/null +++ b/22/CH2/EX2.5/ch2ex5b.jpg diff --git a/22/CH2/EX2.5/ch2ex5c.jpg b/22/CH2/EX2.5/ch2ex5c.jpg Binary files differnew file mode 100755 index 000000000..af4bef4e0 --- /dev/null +++ b/22/CH2/EX2.5/ch2ex5c.jpg diff --git a/22/CH2/EX2.5/que2_5.sce b/22/CH2/EX2.5/que2_5.sce new file mode 100755 index 000000000..684bce501 --- /dev/null +++ b/22/CH2/EX2.5/que2_5.sce @@ -0,0 +1,29 @@ +//time domain analysis of continuous time systems
+//Convolution Integral of input x(t) = (e^-t).u(t)and g(t) =(e^-2*t)u(t)
+clear;
+close;
+clc;
+Max_Limit = 10;
+t = 0:0.001:10;
+for i=1:length(t)
+ g(i) =(exp(-2*t(i)));
+end
+ x= exp(-(t));
+
+y = convol(x,g)
+figure
+a=gca();
+plot2d(t,g)
+xtitle('Impulse Response','t','h(t)');
+a.thickness = 2;
+figure
+a=gca();
+plot2d(t,x)
+xtitle('Input Response','t','x(t)');
+a.thickness = 2;
+figure
+a=gca();
+T=0:0.001:20;
+plot2d(T,y)
+xtitle('Output Response','t','y(t)');
+a.thickness = 2;
\ No newline at end of file diff --git a/22/CH2/EX2.6/ch2ex6b.jpg b/22/CH2/EX2.6/ch2ex6b.jpg Binary files differnew file mode 100755 index 000000000..55e64e3ec --- /dev/null +++ b/22/CH2/EX2.6/ch2ex6b.jpg diff --git a/22/CH2/EX2.6/ch2ex6c.jpg b/22/CH2/EX2.6/ch2ex6c.jpg Binary files differnew file mode 100755 index 000000000..8524ea425 --- /dev/null +++ b/22/CH2/EX2.6/ch2ex6c.jpg diff --git a/22/CH2/EX2.6/que2_6.sce b/22/CH2/EX2.6/que2_6.sce new file mode 100755 index 000000000..f39a22928 --- /dev/null +++ b/22/CH2/EX2.6/que2_6.sce @@ -0,0 +1,29 @@ +//time domain analysis of continuous time systems
+//Convolution Integral of input x(t) = (e^-3t).u(t)and h(t) =(2*e^-2*t-e^-t)u(t)
+clear;
+close;
+clc;
+Max_Limit = 10;
+t = 0:0.001:10;
+for i=1:length(t)
+ g(i) =(2*exp(-2*t(i))-exp(-t(i)));
+end
+ x= exp(-3*(t));
+
+y = convol(x,g)
+figure
+a=gca();
+plot2d(t,g)
+xtitle('Impulse Response','t','h(t)');
+a.thickness = 2;
+figure
+a=gca();
+plot2d(t,x)
+xtitle('Input Response','t','x(t)');
+a.thickness = 2;
+figure
+a=gca();
+T=0:0.001:20;
+plot2d(T,y)
+xtitle('Output Response','t','y(t)');
+a.thickness = 2;
\ No newline at end of file diff --git a/22/CH2/EX2.7/ch2ex7.sce b/22/CH2/EX2.7/ch2ex7.sce new file mode 100755 index 000000000..025d58136 --- /dev/null +++ b/22/CH2/EX2.7/ch2ex7.sce @@ -0,0 +1,30 @@ +//time domain analysis of continuous time systems
+//Convolution Integral of input x(t) = (e^-t).u(t)and g(t) =u(t)
+clear;
+close;
+clc;
+Max_Limit = 10;
+t = -10:0.001:10;
+for i=1:length(t)
+
+ g(i)=exp(-t(i));
+ x(i)=exp(-2*t(i));
+end
+
+y = convol(x,g)
+figure
+a=gca();
+plot2d(t,g)
+xtitle('Impulse Response','t','h(t)');
+a.thickness = 2;
+figure
+a=gca();
+plot2d(t,x)
+xtitle('Input Response','t','x(t)');
+a.thickness = 2;
+figure
+a=gca();
+T=-20:0.001:20;
+plot2d(T,y)
+xtitle('Output Response','t','y(t)');
+a.thickness = 2;
\ No newline at end of file diff --git a/22/CH2/EX2.7/ch2ex7b.jpg b/22/CH2/EX2.7/ch2ex7b.jpg Binary files differnew file mode 100755 index 000000000..c4d581343 --- /dev/null +++ b/22/CH2/EX2.7/ch2ex7b.jpg diff --git a/22/CH2/EX2.7/ch2ex7c.jpg b/22/CH2/EX2.7/ch2ex7c.jpg Binary files differnew file mode 100755 index 000000000..d2f0528e1 --- /dev/null +++ b/22/CH2/EX2.7/ch2ex7c.jpg diff --git a/22/CH2/EX2.8/ch2ex8b.jpg b/22/CH2/EX2.8/ch2ex8b.jpg Binary files differnew file mode 100755 index 000000000..6e6ad5eff --- /dev/null +++ b/22/CH2/EX2.8/ch2ex8b.jpg diff --git a/22/CH2/EX2.8/ch2ex8c.jpg b/22/CH2/EX2.8/ch2ex8c.jpg Binary files differnew file mode 100755 index 000000000..c72f3150a --- /dev/null +++ b/22/CH2/EX2.8/ch2ex8c.jpg diff --git a/22/CH2/EX2.8/que2_8.sce b/22/CH2/EX2.8/que2_8.sce new file mode 100755 index 000000000..960223f07 --- /dev/null +++ b/22/CH2/EX2.8/que2_8.sce @@ -0,0 +1,34 @@ +//time domain analysis of continuous time systems
+//Convolution Integral of input x(t) = (e^-t).u(t)and g(t) =u(t)
+clear;
+close;
+clc;
+Max_Limit = 10;
+t = -10:0.001:10;
+for i=1:length(t)
+ if t(i)<0 then
+ g(i)=-2*exp(2*t(i));
+ x(i)=0;
+ else
+ g(i)=2*exp(-t(i));
+ x(i)=1;
+ end
+end
+
+y = convol(x,g)
+figure
+a=gca();
+plot2d(t,g)
+xtitle('Impulse Response','t','h(t)');
+a.thickness = 2;
+figure
+a=gca();
+plot2d(t,x)
+xtitle('Input Response','t','x(t)');
+a.thickness = 2;
+figure
+a=gca();
+T=-20:0.001:20;
+plot2d(T,y)
+xtitle('Output Response','t','y(t)');
+a.thickness = 2;
\ No newline at end of file diff --git a/22/CH2/EX2.9/ch2ex9b.jpg b/22/CH2/EX2.9/ch2ex9b.jpg Binary files differnew file mode 100755 index 000000000..370335fca --- /dev/null +++ b/22/CH2/EX2.9/ch2ex9b.jpg diff --git a/22/CH2/EX2.9/ch2ex9c.jpg b/22/CH2/EX2.9/ch2ex9c.jpg Binary files differnew file mode 100755 index 000000000..6baab0404 --- /dev/null +++ b/22/CH2/EX2.9/ch2ex9c.jpg diff --git a/22/CH2/EX2.9/que2_9.sce b/22/CH2/EX2.9/que2_9.sce new file mode 100755 index 000000000..0d5f8e3fd --- /dev/null +++ b/22/CH2/EX2.9/que2_9.sce @@ -0,0 +1,35 @@ +//time domain analysis of continuous time systems
+//Convolution Integral of input x(t) = (e^-t).u(t)and g(t) =u(t)
+clear;
+close;
+clc;
+Max_Limit = 10;
+t =linspace(-1,1,10001);
+for i=1:length(t)
+ g(i)=1;
+end
+t1=linspace(0,3,10001);
+for i=1:length(t1)
+x(i)= t1(i)/3;
+end
+y = convol(x,g);
+figure
+a=gca();
+size(t)
+size(g)
+plot2d(t,g)
+xtitle('Impulse Response','t','h(t)');
+a.thickness = 2;
+figure
+a=gca();
+size(x)
+plot2d(t1,x)
+xtitle('Input Response','t','x(t)');
+a.thickness = 2;
+figure
+a=gca();
+T=linspace(-1,4,20001);
+size(y)
+plot2d(T,y)
+xtitle('Output Response','t','y(t)');
+a.thickness = 2;
\ No newline at end of file diff --git a/22/CH3/EX3.1/ch3ex1.jpg b/22/CH3/EX3.1/ch3ex1.jpg Binary files differnew file mode 100755 index 000000000..2c45c599d --- /dev/null +++ b/22/CH3/EX3.1/ch3ex1.jpg diff --git a/22/CH3/EX3.1/ch3ex1.sce b/22/CH3/EX3.1/ch3ex1.sce new file mode 100755 index 000000000..0ed75454d --- /dev/null +++ b/22/CH3/EX3.1/ch3ex1.sce @@ -0,0 +1,14 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//energy of a signal
+clear;
+close;
+clc;
+n=0:1:5
+figure
+a=gca();
+plot2d(n,n);
+energy=sum(n^2)
+power=(1/6)*sum(n^2)
+disp(energy)
+disp(power)
\ No newline at end of file diff --git a/22/CH3/EX3.10/ch3ex10.sce b/22/CH3/EX3.10/ch3ex10.sce new file mode 100755 index 000000000..5d4a422cc --- /dev/null +++ b/22/CH3/EX3.10/ch3ex10.sce @@ -0,0 +1,34 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//total response with initial conditions
+clear;
+close;
+clc;
+n=(-2:10)';
+y=[25/4;0;zeros(length(n)-2,1)];
+x=[0;0;4^-n(3:length(n))];
+for k=1:length(n)-2
+ y(k+2)=0.6*y(k+1)+0.16*y(k)+5*x(k+2);
+end;
+clf;
+a=gca();
+plot2d3(n,y);
+
+y1=[25/4;0;zeros(length(n)-2,1)];
+x=[0;0;4^-n(3:length(n))];
+for k=1:length(n)-2
+ y1(k+2)=-6*y1(k+1)-9*y1(k)+2*x(k+2)+6*x(k+1);
+end
+figure
+a=gca();
+plot2d3(n,y1);
+
+
+y2=[25/4;0;zeros(length(n)-2,1)];
+x=[0;0;4^-n(3:length(n))];
+for k=1:length(n)-2
+ y2(k+2)=1.56*y2(k+1)-0.81*y2(k)+ x(k+1)+3*x(k);
+end
+figure
+a=gca();
+plot2d3(n,y2);
diff --git a/22/CH3/EX3.10/ch3ex10a.jpg b/22/CH3/EX3.10/ch3ex10a.jpg Binary files differnew file mode 100755 index 000000000..1c4d6cff6 --- /dev/null +++ b/22/CH3/EX3.10/ch3ex10a.jpg diff --git a/22/CH3/EX3.10/ch3ex10b.jpg b/22/CH3/EX3.10/ch3ex10b.jpg Binary files differnew file mode 100755 index 000000000..eaf1c06de --- /dev/null +++ b/22/CH3/EX3.10/ch3ex10b.jpg diff --git a/22/CH3/EX3.11/ch3ex11.jpg b/22/CH3/EX3.11/ch3ex11.jpg Binary files differnew file mode 100755 index 000000000..d110f7d82 --- /dev/null +++ b/22/CH3/EX3.11/ch3ex11.jpg diff --git a/22/CH3/EX3.11/ch3ex11.sce b/22/CH3/EX3.11/ch3ex11.sce new file mode 100755 index 000000000..4d976467e --- /dev/null +++ b/22/CH3/EX3.11/ch3ex11.sce @@ -0,0 +1,13 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//impulse response with initial conditions
+clear;
+close;
+clc;
+n=(0:19);
+x=[1 zeros(1,length(n)-1)];
+a=[1 -0.6 -0.16];
+b=[5 0 0];
+h=filter(b,a,x);
+clf;
+plot2d3(n,h); xlabel('n'); ylabel('h[n]');
\ No newline at end of file diff --git a/22/CH3/EX3.13/ch3ex13.jpg b/22/CH3/EX3.13/ch3ex13.jpg Binary files differnew file mode 100755 index 000000000..49f662f9c --- /dev/null +++ b/22/CH3/EX3.13/ch3ex13.jpg diff --git a/22/CH3/EX3.13/ch3ex13.sce b/22/CH3/EX3.13/ch3ex13.sce new file mode 100755 index 000000000..481063f75 --- /dev/null +++ b/22/CH3/EX3.13/ch3ex13.sce @@ -0,0 +1,12 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution
+clear;
+close;
+clc;
+n=(0:19);
+x=0.8^n;
+g=0.3^n;
+n1=(0:1:length(x)+length(g)-2);
+c=convol(x,g);
+plot2d3(n1,c);
diff --git a/22/CH3/EX3.14/ch3ex14.jpg b/22/CH3/EX3.14/ch3ex14.jpg Binary files differnew file mode 100755 index 000000000..24a2ced35 --- /dev/null +++ b/22/CH3/EX3.14/ch3ex14.jpg diff --git a/22/CH3/EX3.14/ch3ex14.sce b/22/CH3/EX3.14/ch3ex14.sce new file mode 100755 index 000000000..d7a2784cb --- /dev/null +++ b/22/CH3/EX3.14/ch3ex14.sce @@ -0,0 +1,14 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution
+clear;
+close;
+clc;
+n=(0:14);
+x=4^-n;
+a=[1 -0.6 -0.16];
+b=[5 0 0];
+y=filter(b,a,x);
+clf;
+plot2d3(n,y); xlabel('n'); ylabel('y[n]');
+
diff --git a/22/CH3/EX3.16/ch3ex16.jpg b/22/CH3/EX3.16/ch3ex16.jpg Binary files differnew file mode 100755 index 000000000..55fa0f0c9 --- /dev/null +++ b/22/CH3/EX3.16/ch3ex16.jpg diff --git a/22/CH3/EX3.16/ch3ex16.sce b/22/CH3/EX3.16/ch3ex16.sce new file mode 100755 index 000000000..fc6e89ef7 --- /dev/null +++ b/22/CH3/EX3.16/ch3ex16.sce @@ -0,0 +1,12 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution by sliding tape method
+clear;
+close;
+clc;
+x=[-2 -1 0 1 2 3 4];
+g=[1 1 1 1 1 1 1 1];
+n=(0:1:length(x)+length(g)-2);
+c=convol(x,g);
+clf;
+plot2d3(n,c); xlabel('n'); ylabel('c[n]');
diff --git a/22/CH3/EX3.17/ch3ex17.jpg b/22/CH3/EX3.17/ch3ex17.jpg Binary files differnew file mode 100755 index 000000000..798473de6 --- /dev/null +++ b/22/CH3/EX3.17/ch3ex17.jpg diff --git a/22/CH3/EX3.17/ch3ex17.sce b/22/CH3/EX3.17/ch3ex17.sce new file mode 100755 index 000000000..bf7514019 --- /dev/null +++ b/22/CH3/EX3.17/ch3ex17.sce @@ -0,0 +1,16 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution by sliding tape method
+clear;
+close;
+clc;
+n=(0:10)';
+y=[4;13;zeros(length(n)-2,1)];
+x=(3*n+5).*(n>=0);
+for k=1:length(n)-2
+ y(k+2)=5*y(k+1)-6*y(k)+x(k+1)-5*x(k);
+end
+clf;
+plot2d3(n,y); xlabel('n'); ylabel('y[n]');
+disp('n y');
+disp(msprintf('%f\t\t%f\n',[n,y]));
\ No newline at end of file diff --git a/22/CH3/EX3.18/ch3ex18.jpg b/22/CH3/EX3.18/ch3ex18.jpg Binary files differnew file mode 100755 index 000000000..5f2fff1ae --- /dev/null +++ b/22/CH3/EX3.18/ch3ex18.jpg diff --git a/22/CH3/EX3.18/ch3ex18.sce b/22/CH3/EX3.18/ch3ex18.sce new file mode 100755 index 000000000..5d868c99a --- /dev/null +++ b/22/CH3/EX3.18/ch3ex18.sce @@ -0,0 +1,16 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution by sliding tape method
+clear;
+close;
+clc;
+n=(0:10)';
+y=[0;zeros(length(n)-1,1)];
+x=(n+1)^2;
+for k=1:length(n)-1
+ y(k+1)=y(k)+x(k);
+end;
+clf;
+a=gca();
+plot2d3(n,y);xtitle('sum','n')
+plot(n,y,'b.')
\ No newline at end of file diff --git a/22/CH3/EX3.19/ch3ex19.jpg b/22/CH3/EX3.19/ch3ex19.jpg Binary files differnew file mode 100755 index 000000000..5f6ecb9d2 --- /dev/null +++ b/22/CH3/EX3.19/ch3ex19.jpg diff --git a/22/CH3/EX3.19/ch3ex19.sce b/22/CH3/EX3.19/ch3ex19.sce new file mode 100755 index 000000000..fd34c2c06 --- /dev/null +++ b/22/CH3/EX3.19/ch3ex19.sce @@ -0,0 +1,13 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution by sliding tape method
+clear;
+close;
+clc;
+n=(0:14);
+x=3^n;
+a=[1 -3 2];
+b=[0 1 2];
+y=filter(b,a,x);
+clf;
+plot2d3(n,y); xlabel('n'); ylabel('y[n]');
diff --git a/22/CH3/EX3.20/ch3ex20.jpg b/22/CH3/EX3.20/ch3ex20.jpg Binary files differnew file mode 100755 index 000000000..6218b62a2 --- /dev/null +++ b/22/CH3/EX3.20/ch3ex20.jpg diff --git a/22/CH3/EX3.20/ch3ex20.sce b/22/CH3/EX3.20/ch3ex20.sce new file mode 100755 index 000000000..c49d0107d --- /dev/null +++ b/22/CH3/EX3.20/ch3ex20.sce @@ -0,0 +1,14 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//convolution by sliding tape method
+clear;
+close;
+clc;
+pi=3.14;
+n=(0:14);
+x=cos(2*n+pi/3);
+a=[1 -1 0.16];
+b=[0 1 0.32];
+y=filter(b,a,x);
+clf;
+plot2d3(n,y); xlabel('n'); ylabel('y[n]');
diff --git a/22/CH3/EX3.8/ch3ex8.jpg b/22/CH3/EX3.8/ch3ex8.jpg Binary files differnew file mode 100755 index 000000000..cb817ea3c --- /dev/null +++ b/22/CH3/EX3.8/ch3ex8.jpg diff --git a/22/CH3/EX3.8/ch3ex8.sce b/22/CH3/EX3.8/ch3ex8.sce new file mode 100755 index 000000000..cf7361f87 --- /dev/null +++ b/22/CH3/EX3.8/ch3ex8.sce @@ -0,0 +1,18 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//iterative solution
+clear;
+close;
+clc;
+n=(-1:10)';
+y=[16;0;zeros(length(n)-2,1)];
+x=[0;0;n(3:length(n))];
+for k=1:length(n)-1
+ y(k+1)=0.5*y(k)+x(k+1);
+end;
+clf;
+size(y)
+size(n)
+plot2d3(n,y);
+plot(n,y,'r.')
+disp([msprintf([n,y])]);
diff --git a/22/CH3/EX3.9/ch3ex9.jpg b/22/CH3/EX3.9/ch3ex9.jpg Binary files differnew file mode 100755 index 000000000..b9fcea43d --- /dev/null +++ b/22/CH3/EX3.9/ch3ex9.jpg diff --git a/22/CH3/EX3.9/ch3ex9.sce b/22/CH3/EX3.9/ch3ex9.sce new file mode 100755 index 000000000..b651f07e0 --- /dev/null +++ b/22/CH3/EX3.9/ch3ex9.sce @@ -0,0 +1,15 @@ +//signals and systems
+//time domain analysis of discreet time systems
+//iterative solution
+clear;
+close;
+clc;
+n=(-2:10)';
+y=[1;2;zeros(length(n)-2,1)];
+x=[0;0;n(3:length(n))];
+for k=1:length(n)-2
+ y(k+2)=y(k+1)-0.24*y(k)+x(k+2)-2*x(k+1);
+end;
+clf;
+plot2d3(n,y);
+disp([msprintf([n,y])]);
diff --git a/22/CH4/EX4.1/ch4ex1.jpg b/22/CH4/EX4.1/ch4ex1.jpg Binary files differnew file mode 100755 index 000000000..2c6460fb1 --- /dev/null +++ b/22/CH4/EX4.1/ch4ex1.jpg diff --git a/22/CH4/EX4.1/ch4ex1.sce b/22/CH4/EX4.1/ch4ex1.sce new file mode 100755 index 000000000..5198eeaac --- /dev/null +++ b/22/CH4/EX4.1/ch4ex1.sce @@ -0,0 +1,10 @@ +//signals and systems
+//Laplace Transform x(t) = exp(-at).u(t) for t negative and positive
+syms t s;
+a = 3;
+y =laplace('%e^(-a*t)',t,s);
+t1=0:0.001:10;
+plot2d(t1,exp(-a*t1));
+disp(y)
+y1 = laplace('%e^(a*-t)',t,s);
+disp(y1)
diff --git a/22/CH4/EX4.10/ch4ex10.sce b/22/CH4/EX4.10/ch4ex10.sce new file mode 100755 index 000000000..57dca52f0 --- /dev/null +++ b/22/CH4/EX4.10/ch4ex10.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.10
+s = %s;
+syms t;
+[A] = pfss((2*s^2+20*s+45)/((s+2)*(s+3)*(s+4)));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F3 = ilaplace(A(3),s,t)
+F = F1+F2+F3
+disp(F)
diff --git a/22/CH4/EX4.11/ch4ex11.sce b/22/CH4/EX4.11/ch4ex11.sce new file mode 100755 index 000000000..d331bc68a --- /dev/null +++ b/22/CH4/EX4.11/ch4ex11.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.11
+s = %s;
+syms t;
+[A] = pfss((2*s)/(s^2+2*s+5));
+F1 = ilaplace(A(1),s,t)
+//F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2+F3
+disp(F)
diff --git a/22/CH4/EX4.12/ch4ex12.sce b/22/CH4/EX4.12/ch4ex12.sce new file mode 100755 index 000000000..d4bfd3876 --- /dev/null +++ b/22/CH4/EX4.12/ch4ex12.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.12
+s = %s;
+syms t;
+[A] = pfss((3*s+3)/((s+5)*(s^2+5*s+6)));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F3 = ilaplace(A(3),s,t)
+F = F1+F2+F3
+disp(F)
diff --git a/22/CH4/EX4.15/ch4ex15.sce b/22/CH4/EX4.15/ch4ex15.sce new file mode 100755 index 000000000..f2a304a38 --- /dev/null +++ b/22/CH4/EX4.15/ch4ex15.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.15
+s = %s;
+syms t;
+[A] = pfss((10)/(s^2+3*s+2));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2+F3
+disp(F)
diff --git a/22/CH4/EX4.16/ch4ex16.sce b/22/CH4/EX4.16/ch4ex16.sce new file mode 100755 index 000000000..f13e0303e --- /dev/null +++ b/22/CH4/EX4.16/ch4ex16.sce @@ -0,0 +1,9 @@ +//signals and systems
+//Unilateral Laplace Transform: transfer function
+//example 4.16
+s = %s;
+syms t s;
+y1 =laplace('24*%e^(-3*t)+48*%e^(-4*t)',t,s);
+disp(y1)
+y2 =laplace('16*%e^(-3*t)-12*%e^(-4*t)',t,s);
+disp(y2)
diff --git a/22/CH4/EX4.17/ch4ex17.sce b/22/CH4/EX4.17/ch4ex17.sce new file mode 100755 index 000000000..b8975d1ea --- /dev/null +++ b/22/CH4/EX4.17/ch4ex17.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.17
+s= %s;
+syms t;
+[A] = pfss((2*s^2+9*s+4)/((s)*(s^2+3*s+1)));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F3 = ilaplace(A(3),s,t)
+F = F1+F2+F3
+disp(F)
\ No newline at end of file diff --git a/22/CH4/EX4.2/ch4ex2.sce b/22/CH4/EX4.2/ch4ex2.sce new file mode 100755 index 000000000..eade38b3a --- /dev/null +++ b/22/CH4/EX4.2/ch4ex2.sce @@ -0,0 +1,14 @@ +//signals and systems
+//(a) laplace transform x(t) = del(t)
+syms t s;
+
+y =laplace('0',t,s)
+disp(y)
+//(b) Laplace Transform x(t) = u(t)
+
+y1 =laplace('1',t,s);
+disp(y1)
+//(c) laplace transform x(t) = cos(w0*t)u(t)
+
+y2 =laplace('cos(w0*t)',t,s);
+disp(y2)
\ No newline at end of file diff --git a/22/CH4/EX4.23/ch4ex23.jpg b/22/CH4/EX4.23/ch4ex23.jpg Binary files differnew file mode 100755 index 000000000..399071d7e --- /dev/null +++ b/22/CH4/EX4.23/ch4ex23.jpg diff --git a/22/CH4/EX4.23/ch4ex23.sce b/22/CH4/EX4.23/ch4ex23.sce new file mode 100755 index 000000000..27dccfba8 --- /dev/null +++ b/22/CH4/EX4.23/ch4ex23.sce @@ -0,0 +1,3 @@ +s=poly(0,'s')
+h=syslin('c',(s+0.1)/(s+5))
+clf();bode(h,0.1,100);
\ No newline at end of file diff --git a/22/CH4/EX4.24/ch4ex24.sce b/22/CH4/EX4.24/ch4ex24.sce new file mode 100755 index 000000000..a6ed29979 --- /dev/null +++ b/22/CH4/EX4.24/ch4ex24.sce @@ -0,0 +1,5 @@ +s=poly(0,'s')
+h=syslin('c',(s^2/s))
+clf();bode(h,0.1,100);
+h1=syslin('c',(1/s))
+clf(); bode(h1,0.1,100);
\ No newline at end of file diff --git a/22/CH4/EX4.24/ch4ex24a.jpg b/22/CH4/EX4.24/ch4ex24a.jpg Binary files differnew file mode 100755 index 000000000..2949316f3 --- /dev/null +++ b/22/CH4/EX4.24/ch4ex24a.jpg diff --git a/22/CH4/EX4.24/ch4ex24b.jpg b/22/CH4/EX4.24/ch4ex24b.jpg Binary files differnew file mode 100755 index 000000000..9a199cf6d --- /dev/null +++ b/22/CH4/EX4.24/ch4ex24b.jpg diff --git a/22/CH4/EX4.25/ch4ex25.jpg b/22/CH4/EX4.25/ch4ex25.jpg Binary files differnew file mode 100755 index 000000000..e4c4bccab --- /dev/null +++ b/22/CH4/EX4.25/ch4ex25.jpg diff --git a/22/CH4/EX4.25/ch4ex25.sce b/22/CH4/EX4.25/ch4ex25.sce new file mode 100755 index 000000000..203db6c16 --- /dev/null +++ b/22/CH4/EX4.25/ch4ex25.sce @@ -0,0 +1,3 @@ +s=poly(0,'s')
+h=syslin('c',((20*s^2+2000*s)/(s^2+12*s+20)))
+clf();bode(h,0.1,100);
\ No newline at end of file diff --git a/22/CH4/EX4.26/ch4ex26.jpg b/22/CH4/EX4.26/ch4ex26.jpg Binary files differnew file mode 100755 index 000000000..5bec75d80 --- /dev/null +++ b/22/CH4/EX4.26/ch4ex26.jpg diff --git a/22/CH4/EX4.26/ch4ex26.sce b/22/CH4/EX4.26/ch4ex26.sce new file mode 100755 index 000000000..cdc4b7ab1 --- /dev/null +++ b/22/CH4/EX4.26/ch4ex26.sce @@ -0,0 +1,3 @@ +s=poly(0,'s')
+h=syslin('c',((10*s+1000)/(s^2+2*s+100)))
+clf();bode(h,0.1,100);
\ No newline at end of file diff --git a/22/CH4/EX4.27/ch4ex27.jpg b/22/CH4/EX4.27/ch4ex27.jpg Binary files differnew file mode 100755 index 000000000..51b8197d9 --- /dev/null +++ b/22/CH4/EX4.27/ch4ex27.jpg diff --git a/22/CH4/EX4.27/ch4ex27.sce b/22/CH4/EX4.27/ch4ex27.sce new file mode 100755 index 000000000..0389caa79 --- /dev/null +++ b/22/CH4/EX4.27/ch4ex27.sce @@ -0,0 +1,10 @@ +omega_0=2*%pi*60; theta = [60 80 87]*(%pi/180);
+omega = (0:0.5:1000)'; mag = zeros(3,length(omega));
+s=poly(0,'s')
+for m =1:length(theta)
+ H=syslin('c',((s^2+omega_0^2)/(s^2+2*omega_0*cos(theta(m))*s +omega_0^2)));
+ bode(H,10,100);
+end
+f=omega/((2*%pi))plot(f,mag(1,:),'k-',f mag(2,:),'k--',f,mag(3,:),'k-.');
+xlabel('f[hz]'); ylabel('|H(j2/pi f)|');
+legend('\theta=60^\circ','\theta = 80^\circ','\theta = 87^\circ',0)
\ No newline at end of file diff --git a/22/CH4/EX4.28/ch4ex28.sce b/22/CH4/EX4.28/ch4ex28.sce new file mode 100755 index 000000000..b4d76fd0a --- /dev/null +++ b/22/CH4/EX4.28/ch4ex28.sce @@ -0,0 +1,30 @@ +//signals and systems
+//bilateral Inverse Lapalce Transform
+//X(S) = 1/((s-1)(s+2))
+s =%s ;
+syms t ;
+[A]=pfss(1/((s-1)*(s+2))) //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F=F1+F2;
+disp(F,"f(t)=")
+
+
+//X(S) = 1/((s-1)(s+2)) Re(s)> -1,Re(s)< -2
+s =%s ;
+syms t ;
+[A]=pfss(1/((s-1)*(s+2))) //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F = -F1-F2;
+disp(F,"f(t)=")
+
+
+//X(S) = 1/((s-1)(s+2)) -2< Re(s)< 1
+s =%s ;
+syms t ;
+[A]=pfss(1/((s-1)*(s+2))) //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F = -F1+F2;
+disp(F,"f(t)=")
\ No newline at end of file diff --git a/22/CH4/EX4.29/ch4ex29.sce b/22/CH4/EX4.29/ch4ex29.sce new file mode 100755 index 000000000..663dbcc70 --- /dev/null +++ b/22/CH4/EX4.29/ch4ex29.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.30
+s= %s;
+syms t;
+[A] = pfss((-s)/((s-1)*(s-2)*(s+1)));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F3 = ilaplace(A(3),s,t)
+F = F1+F2+F3
+disp(F)
\ No newline at end of file diff --git a/22/CH4/EX4.3.a/ch4ex3a.sce b/22/CH4/EX4.3.a/ch4ex3a.sce new file mode 100755 index 000000000..cffac0944 --- /dev/null +++ b/22/CH4/EX4.3.a/ch4ex3a.sce @@ -0,0 +1,12 @@ +//signals and systems
+//Inverse Lapalce Transform
+//(a) X(S) = (7s-6)/s^2-s-6 Re(s)>-1
+s =%s ;
+syms t ;
+[A]=pfss((7*s-6)/((s^2-s-6))); //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2;
+disp(F,"f(t)=")
+
diff --git a/22/CH4/EX4.3.b/ch4ex3b.sce b/22/CH4/EX4.3.b/ch4ex3b.sce new file mode 100755 index 000000000..52f7301c7 --- /dev/null +++ b/22/CH4/EX4.3.b/ch4ex3b.sce @@ -0,0 +1,10 @@ +//example 4.3
+//(b) X(S) = (2*s^2+5)/s^2-3*s+2 Re(s)>-1
+s =%s ;
+syms t ;
+[A]=pfss((2*s^2+5)/((s^2-3*s+2))); //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2;
+disp(F,"f(t)=")
\ No newline at end of file diff --git a/22/CH4/EX4.3.c/ch4ex3c.sce b/22/CH4/EX4.3.c/ch4ex3c.sce new file mode 100755 index 000000000..270164745 --- /dev/null +++ b/22/CH4/EX4.3.c/ch4ex3c.sce @@ -0,0 +1,10 @@ +//example4.3
+//(c) X(S) = 6(s+34)/s(s^2+10*s+34) Re(s)>-1
+s =%s ;
+syms t ;
+[A]=pfss((6*(s+34))/(s*(s^2+10*s+34))); //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2;
+disp(F,"f(t)=")
\ No newline at end of file diff --git a/22/CH4/EX4.30/ch4ex30.sce b/22/CH4/EX4.30/ch4ex30.sce new file mode 100755 index 000000000..3ec2abb49 --- /dev/null +++ b/22/CH4/EX4.30/ch4ex30.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.30
+s= %s;
+syms t;
+[A] = pfss((-1)/((s-1)*(s+2)));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2
+disp(F)
\ No newline at end of file diff --git a/22/CH4/EX4.31/ch4ex31.sce b/22/CH4/EX4.31/ch4ex31.sce new file mode 100755 index 000000000..8f3e02fb2 --- /dev/null +++ b/22/CH4/EX4.31/ch4ex31.sce @@ -0,0 +1,19 @@ +//signals and systems
+//Unilateral Laplace Transform:Solving Differential Equation
+//example 4.17
+s= %s;
+syms t;
+// Re s>-1
+[A] = pfss(1/((s+1)*(s+5)));
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2
+disp(F)
+//-5< Re s <-2
+[B] = pfss(-1/((s+2)*(s+5)));
+G1 = ilaplace(B(1),s,t)
+G2 = ilaplace(B(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+G = G1+G2
+disp(G)
\ No newline at end of file diff --git a/22/CH4/EX4.4/ch4ex4.sce b/22/CH4/EX4.4/ch4ex4.sce new file mode 100755 index 000000000..1b6a89b4a --- /dev/null +++ b/22/CH4/EX4.4/ch4ex4.sce @@ -0,0 +1,11 @@ +//signals and systems
+//Lapalce Transform x(t) = (t-1)u(t-1)-(t-2)u(t-2)-u(t-4), 0<t<T
+syms t s;
+a = 3;
+T = 1;
+//t = T;
+y1 = laplace('t',t,s);
+y2 = laplace('t',t,s);
+y3 = laplace('1',t,s);
+y=y1*(%e^(-s))+y2*(%e^(-2*s))+y3*(%e^(-4*s))
+disp(y)
\ No newline at end of file diff --git a/22/CH4/EX4.5/ch4ex5.sce b/22/CH4/EX4.5/ch4ex5.sce new file mode 100755 index 000000000..f4fdc2f01 --- /dev/null +++ b/22/CH4/EX4.5/ch4ex5.sce @@ -0,0 +1,17 @@ +//signals and systems
+//example4.5
+// X(S) = s+3+5*exp(-2*s)/(s+1)*(s+2)) Re(s)>-1
+s1 =%s ;
+syms t s;
+[A]=pfss((s1+3)/((s1+1)*(s1+2))); //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+Fa = F1+F2;
+disp(Fa,"f1(t)=")
+[B]=pfss((5)/((s1+1)*(s1+2))); //partial fraction of F(s)
+F1 = ilaplace(B(1),s,t)
+F2 = ilaplace(B(2),s,t)
+Fb = (F1+F2)*(%e^(-2*s));
+disp(Fb,"f2(t)=")
+disp(Fa+Fb,"f(t)=")
\ No newline at end of file diff --git a/22/CH4/EX4.8/ch4ex8.sce b/22/CH4/EX4.8/ch4ex8.sce new file mode 100755 index 000000000..9230c2587 --- /dev/null +++ b/22/CH4/EX4.8/ch4ex8.sce @@ -0,0 +1,12 @@ + //signals and systems
+//Example 4.8
+//Lapalce Transform for convolution
+s=%s
+syms t ;
+a=3;b=2;
+[A]=pfss(1/(s^2-5*s+6)); //partial fraction of F(s)
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+//F3 = ilaplace(A(3),s,t)
+F = F1+F2;
+disp(F,"f(t)=")
\ No newline at end of file diff --git a/22/CH4/EX4.9/ch4ex9.sce b/22/CH4/EX4.9/ch4ex9.sce new file mode 100755 index 000000000..6f6a695e4 --- /dev/null +++ b/22/CH4/EX4.9/ch4ex9.sce @@ -0,0 +1,11 @@ +//Initial and final Value Theorem of Lapalace Transform
+syms s;
+num =poly([30 20],'s','coeff')
+den =poly([0 5 2 1],'s','coeff')
+X = num/den
+disp (X,"X(s)=")
+SX = s*X;
+Initial_Value =limit(SX,s,%inf);
+final_value =limit(SX,s,0);
+disp(Initial_Value,"x(0)=")
+disp(final_value,"x(inf)=")
\ No newline at end of file diff --git a/22/CH5/EX5.1/ch5ex1.jpg b/22/CH5/EX5.1/ch5ex1.jpg Binary files differnew file mode 100755 index 000000000..483e7bdd1 --- /dev/null +++ b/22/CH5/EX5.1/ch5ex1.jpg diff --git a/22/CH5/EX5.1/ch5ex1.sce b/22/CH5/EX5.1/ch5ex1.sce new file mode 100755 index 000000000..ca9d2c11d --- /dev/null +++ b/22/CH5/EX5.1/ch5ex1.sce @@ -0,0 +1,10 @@ +//signals and systems
+// Ztransform of x[n] = (a)^n.u[n]
+syms n z;
+a = 0.5;
+x =(a)^n;
+n1=0:10;
+plot2d3(n1,a^n1); xtitle('a^n','n');
+plot(n1,a^n1,'r.')
+X = symsum(x*(z^(-n)),n,0,%inf)
+disp(X,"ans=")
\ No newline at end of file diff --git a/22/CH5/EX5.10/ch5ex10.jpg b/22/CH5/EX5.10/ch5ex10.jpg Binary files differnew file mode 100755 index 000000000..1da11eb02 --- /dev/null +++ b/22/CH5/EX5.10/ch5ex10.jpg diff --git a/22/CH5/EX5.10/ch5ex10.sce b/22/CH5/EX5.10/ch5ex10.sce new file mode 100755 index 000000000..648263714 --- /dev/null +++ b/22/CH5/EX5.10/ch5ex10.sce @@ -0,0 +1,10 @@ +omega= linspace(-%pi,%pi,106);
+H= syslin('c',(s/(s-0.8)));
+H_omega= squeeze(calfrq(H,0.01,10));
+size(H_omega)
+subplot(2,1,1); plot2d(omega, abs(H_omega));
+//xlabel('\omega');
+//ylabel('|H[e^{j\omega}]|');
+subplot(2,1,2); plot2d(omega,atan(imag(H_omega),real(H_omega))*180/%pi);
+//xlabel('\omega');
+//ylabel('\angle H[e^{j \omega}] [deg]');
\ No newline at end of file diff --git a/22/CH5/EX5.12/ch5ex12.sce b/22/CH5/EX5.12/ch5ex12.sce new file mode 100755 index 000000000..10f77140b --- /dev/null +++ b/22/CH5/EX5.12/ch5ex12.sce @@ -0,0 +1,5 @@ +//signals and systems
+//maximum sampling interval
+f=50*10^3;
+T=0.5/f;
+disp(T)//in seconds
\ No newline at end of file diff --git a/22/CH5/EX5.13/ch5ex13.sce b/22/CH5/EX5.13/ch5ex13.sce new file mode 100755 index 000000000..e8431b617 --- /dev/null +++ b/22/CH5/EX5.13/ch5ex13.sce @@ -0,0 +1,5 @@ +//signals and systems
+//highest frequency of a signal
+T=25*10^-6
+f=0.5/T
+disp(f)//in hertz
\ No newline at end of file diff --git a/22/CH5/EX5.17/ch5ex17.sce b/22/CH5/EX5.17/ch5ex17.sce new file mode 100755 index 000000000..2ea480242 --- /dev/null +++ b/22/CH5/EX5.17/ch5ex17.sce @@ -0,0 +1,12 @@ +//Z transform of x[n] = a^n.u[n]+b^-n.u[-n-1]
+syms n z;
+a=0.9
+b = 1.2;
+
+x1=(a)^(n)
+x2=(b)^(-n)
+//plot2d3(n1,x1+x2)
+X1=symsum(x1*(z^(-n)),n,0,%inf)
+X2=symsum(x2*(z^(n)),n,1,%inf)
+X = X1+X2;
+disp(X,"ans=")
diff --git a/22/CH5/EX5.18/ch5ex18.sce b/22/CH5/EX5.18/ch5ex18.sce new file mode 100755 index 000000000..cfb08de6d --- /dev/null +++ b/22/CH5/EX5.18/ch5ex18.sce @@ -0,0 +1,46 @@ +//signals and systems
+//Inverse Z Transform:ROC |z|>2
+z = %z;
+syms n z1;//To find out Inverse z transform z must be linear z = z1
+X =-z*(z+0.4)/((z-0.8)*(z-2))
+X1 = denom(X);
+zp = roots(X1);
+X1 = -z1*(z1+0.4)/((z1-0.8)*(z1-2))
+F1 = X1*(z1^(n-1))*(z1-zp(1));
+F2 = X1*(z1^(n-1))*(z1-zp(2));
+h1 = limit(F1,z1,zp(1));
+disp(h1,'h1[n]=')
+h2 = limit(F2,z1,zp(2));
+disp(h2,'h2[n]=')
+h = h1+h2;
+disp(h,'h[n]=')
+
+//Inverse Z Transform:ROC 0.8<|z|<2
+z = %z;
+syms n z1;
+X =-z*(z+0.4)/((z-0.8)*(z-2))
+X1 = denom(X);
+zp = roots(X1);
+X1 = -z1*(z1+0.4)/((z1-0.8)*(z1-2))
+F1 = X1*(z1^(n-1))*(z1-zp(1));
+F2 = X1*(z1^(n-1))*(z1-zp(2));
+h1 = limit(F1,z1,zp(1));
+disp(h1*'u(n)','h1[n]=')
+h2 = limit(F2,z1,zp(2));
+disp((h2)*'u(-n-1)','h2[n]=')
+disp((h1)*'u(n)'-(h2)*'u(n-1)','h[n]=')
+
+//Inverse Z Transform:ROC |z|<0.8
+z = %z;
+syms n z1;
+X =-z*(z+0.4)/((z-0.8)*(z-2))
+X1 = denom(X);
+zp = roots(X1);
+X1 = -z1*(z1+0.4)/((z1-0.8)*(z1-2))
+F1 = X1*(z1^(n-1))*(z1-zp(1));
+F2 = X1*(z1^(n-1))*(z1-zp(2));
+h1 = limit(F1,z1,zp(1));
+disp(h1*'u(-n-1)','h1[n]=')
+h2 = limit(F2,z1,zp(2));
+disp((h2)*'u(-n-1)','h2[n]=')
+disp(-(h1)*'u(-n-1)'-(h2)*'u(-n-1)','h[n]=')
\ No newline at end of file diff --git a/22/CH5/EX5.19/ch5ex19.sce b/22/CH5/EX5.19/ch5ex19.sce new file mode 100755 index 000000000..22aa4bb3c --- /dev/null +++ b/22/CH5/EX5.19/ch5ex19.sce @@ -0,0 +1,19 @@ +//LTi Systems characterized by Linear Constant
+//Coefficient Difference equations
+//Inverse Z Transform
+//z = %z;
+syms n z;
+H1 = -z/(z-0.5);
+H2 = (8/3)*z/(z-0.8);
+H3=(-8/3)*z/(z-2);
+F1 = H1*z^(n-1)*(z-0.5);
+F2 = H2*z^(n-1)*(z-0.8);
+F3 = H3*z^(n-1)*(z-2);
+h1 = limit(F1,z,0.5);
+disp(h1,'h1[n]=')
+h2 = limit(F2,z,0.8);
+disp(h2,'h2[n]=')
+h3 = limit(F3,z,2);
+disp(h3,'h3[n]=')
+h = h1+h2+h3;
+disp(h,'h[n]=')
diff --git a/22/CH5/EX5.2/ch5ex2.sce b/22/CH5/EX5.2/ch5ex2.sce new file mode 100755 index 000000000..39cc98136 --- /dev/null +++ b/22/CH5/EX5.2/ch5ex2.sce @@ -0,0 +1,29 @@ +//example 5.2 (c)
+//Z-transform of sine signal
+syms n z;
+Wo =%pi/4;
+a = (0.33)^n;
+x1=%e^(sqrt(-1)*Wo*n);
+X1=symsum(a*x1*(z^(-n)),n,0,%inf)
+x2=%e^(-sqrt(-1)*Wo*n)
+X2=symsum(a*x2*(z^(-n)),n,0,%inf)
+X =(1/(2*sqrt(-1)))*(X1+X2)
+disp(X,"ans=")
+
+//example 5.2 (a)
+//Z-transform of Impulse Sequence
+syms n z;
+X=symsum(1*(z^(-n)),n,0,0);
+disp(X,"ans=")
+
+//example 5.2 (d)
+//Z-transform of given Sequence
+syms n z;
+X=symsum(1*(z^(-n)),n,0,4);
+disp(X,"ans=")
+
+//example 5.2 (b)
+//Z-transform of unit function Sequence
+syms n z;
+X=symsum(1*(z^(-n)),n,0,%inf);
+disp(X,"ans=")
\ No newline at end of file diff --git a/22/CH5/EX5.20/ch5ex20.sce b/22/CH5/EX5.20/ch5ex20.sce new file mode 100755 index 000000000..763e67fec --- /dev/null +++ b/22/CH5/EX5.20/ch5ex20.sce @@ -0,0 +1,23 @@ +//LTi Systems characterized by Linear Constant
+//Coefficient Difference equations
+//Inverse Z Transform
+//z = %z;
+syms n z;
+H1 = (-5/3)*z/(z-0.5);
+H2 = (8/3)*z/(z-0.8);
+H3=5*z/(z-0.5);
+H4=-6*z/(z-0.6);
+F1 = H1*z^(n-1)*(z-0.5);
+F2 = H2*z^(n-1)*(z-0.8);
+F3 = H3*z^(n-1)*(z-0.5);
+F4 = H4*z^(n-1)*(z-0.6);
+h1 = limit(F1,z,0.5);
+disp(h1,'h1[n]=')
+h2 = limit(F2,z,0.8);
+disp(h2,'h2[n]=')
+h3 = limit(F3,z,0.5);
+disp(h3,'h3[n]=')
+h4 = limit(F4,z,0.6);
+disp(h4,'h4[n]=')
+h = h1+h2+h3+h4;
+disp(h,'h[n]=')
diff --git a/22/CH5/EX5.3.a/ch5ex3a.sce b/22/CH5/EX5.3.a/ch5ex3a.sce new file mode 100755 index 000000000..83a9b7c66 --- /dev/null +++ b/22/CH5/EX5.3.a/ch5ex3a.sce @@ -0,0 +1,16 @@ +//signals and systems
+//Inverse Z Transform:ROC |z|>1/3
+z = %z;
+syms n z1;//To find out Inverse z transform z must be linear z = z1
+X =(8*z-19)/((z-2)*(z-3))
+X1 = denom(X);
+zp = roots(X1);
+X1 = (8*z1-19)/((z1-2)*(z1-3))
+F1 = X1*(z1^(n-1))*(z1-zp(1));
+F2 = X1*(z1^(n-1))*(z1-zp(2));
+h1 = limit(F1,z1,zp(1));
+disp(h1,'h1[n]=')
+h2 = limit(F2,z1,zp(2));
+disp(h2,'h2[n]=')
+h = h1+h2;
+disp(h,'h[n]=')
\ No newline at end of file diff --git a/22/CH5/EX5.3.c/ch5ex3c.sce b/22/CH5/EX5.3.c/ch5ex3c.sce new file mode 100755 index 000000000..3f2bb0db0 --- /dev/null +++ b/22/CH5/EX5.3.c/ch5ex3c.sce @@ -0,0 +1,16 @@ +//signals and systems
+//Inverse Z Transform:ROC |z|>1/3
+z = %z;
+syms n z1;//To find out Inverse z transform z must be linear z = z1
+X =(2*z*(3*z+17))/((z-1)*(z^2-6*z+25))
+X1 = denom(X);
+zp = roots(X1);
+X1 = 2*z1*(3*z1+17)/((z1-1)*(z1^2-6*z1+25))
+F1 = X1*(z1^(n-1))*(z1-zp(1));
+F2 = X1*(z1^(n-1))*(z1-zp(2));
+h1 = limit(F1,z1,zp(1));
+disp(h1,'h1[n]=')
+h2 = limit(F2,z1,zp(2));
+disp(h2,'h2[n]=')
+h = h1+h2;
+disp(h,'h[n]=')
\ No newline at end of file diff --git a/22/CH5/EX5.5/ch5ex5.sce b/22/CH5/EX5.5/ch5ex5.sce new file mode 100755 index 000000000..e030c8ed8 --- /dev/null +++ b/22/CH5/EX5.5/ch5ex5.sce @@ -0,0 +1,19 @@ +//LTi Systems characterized by Linear Constant
+//Coefficient Difference equations
+//Inverse Z Transform
+//z = %z;
+syms n z;
+H1 = (26/15)/(z-(1/2));
+H2 = (7/3)/(z-2);
+H3 = (18/5)/(z-3);
+F1 = H1*z^(n)*(z-(1/2));
+F2 = H2*z^(n)*(z-2);
+F3 = H3*z^(n)*(z-3);
+h1 = limit(F1,z,1/2);
+disp(h1,'h1[n]=')
+h2 = limit(F2,z,2);
+disp(h2,'h2[n]=')
+h3 = limit(F3,z,3);
+disp(h3,'h3[n]=')
+h = h1-h2+h3;
+disp(h,'h[n]=')
\ No newline at end of file diff --git a/22/CH5/EX5.6/ch5ex6.sce b/22/CH5/EX5.6/ch5ex6.sce new file mode 100755 index 000000000..7ea80247f --- /dev/null +++ b/22/CH5/EX5.6/ch5ex6.sce @@ -0,0 +1,19 @@ +//LTi Systems characterized by Linear Constant
+//Coefficient Difference equations
+//Inverse Z Transform
+//z = %z;
+syms n z;
+H1 = (2/3)/(z+0.2);
+H2 = (8/3)/(z+0.8);
+H3 = (2)/(z+0.5);
+F1 = H1*z^(n)*(z+0.2);
+F2 = H2*z^(n)*(z+0.8);
+F3 = H3*z^(n)*(z+0.5);
+h1 = limit(F1,z,-0.2);
+disp(h1,'h1[n]=')
+h2 = limit(F2,z,-0.8);
+disp(h2,'h2[n]=')
+h3 = limit(F3,z,-0.5);
+disp(h3,'h3[n]=')
+h = h1-h2+h3;
+disp(h,'h[n]=')
\ No newline at end of file diff --git a/22/CH6/EX6.1/ch6ex1.jpg b/22/CH6/EX6.1/ch6ex1.jpg Binary files differnew file mode 100755 index 000000000..36260ae40 --- /dev/null +++ b/22/CH6/EX6.1/ch6ex1.jpg diff --git a/22/CH6/EX6.1/ch6ex1.sce b/22/CH6/EX6.1/ch6ex1.sce new file mode 100755 index 000000000..fe40d271d --- /dev/null +++ b/22/CH6/EX6.1/ch6ex1.sce @@ -0,0 +1,17 @@ +n=0:10;
+a_n=0.504*2*ones(1,length(n))./(1+16*n.^2);
+a_n(1)=0.504
+b_n=0.504*8*n./(1+16*n.*n);
+size(n)
+size(a_n)
+size(b_n)
+disp(b_n(1))
+C_n=sqrt(a_n.^2+(b_n).^2);
+theta_n(1)=0; theta_n=atan(-b_n,a_n);
+//n=[0,n];
+clf;
+size(n)
+subplot(2,2,1); plot2d3(n,a_n);xtitle('a_n','n');plot(n,a_n,'ro');
+subplot(2,2,2); plot2d3(n,b_n);xtitle('b_n','n');plot(n,b_n,'r.');
+subplot(2,2,3); plot2d3(n,C_n);xtitle('C_n','n');plot(n,C_n,'ro');
+subplot(2,2,4); plot2d3(n,theta_n,);xtitle('theta_n','n');plot(n,theta_n,'r.')
diff --git a/22/CH6/EX6.2/ch6ex2.jpg b/22/CH6/EX6.2/ch6ex2.jpg Binary files differnew file mode 100755 index 000000000..ffaf67f69 --- /dev/null +++ b/22/CH6/EX6.2/ch6ex2.jpg diff --git a/22/CH6/EX6.2/ch6ex2.sce b/22/CH6/EX6.2/ch6ex2.sce new file mode 100755 index 000000000..120ff4edb --- /dev/null +++ b/22/CH6/EX6.2/ch6ex2.sce @@ -0,0 +1,18 @@ + n=0:10;
+a_n=zeros(1,length(n));
+size(a_n)
+b_n=(8/%pi^2*n.^2).*sin(n.*%pi/2);
+size(n)
+size(a_n)
+size(b_n)
+disp(b_n(1))
+C_n=b_n
+//theta_n(1)=0;
+ theta_n=atan(-b_n,a_n);
+//n=[0,n];
+clf;
+size(n)
+subplot(2,2,1); plot2d3(n,a_n); xtitle('a_n','n');plot(n,a_n,'ro')
+subplot(2,2,2); plot2d3(n,b_n);xtitle('b_n','n');plot(n,b_n,'r.')
+subplot(2,2,3); plot2d3(n,C_n);xtitle('C_n','n');plot(n,C_n,'ro')
+subplot(2,2,4); plot2d3(n,theta_n,);xtitle('theta_n','n');plot(n,theta_n,'r.')
diff --git a/22/CH6/EX6.3/ch6ex4.sce b/22/CH6/EX6.3/ch6ex4.sce new file mode 100755 index 000000000..fcd5a74cb --- /dev/null +++ b/22/CH6/EX6.3/ch6ex4.sce @@ -0,0 +1,26 @@ +n=0:10;
+
+for n=0:10
+ //if(n%2==0)
+ // a_n=0;
+ //else
+ if (n==4*n-3)
+ a_n=2/(%pi.*n);
+ else if (n==4*n-1)
+ a_n=-2/(%pi.*n);
+ end end end
+
+b_n=zeros(1,length(n));
+size(n)
+size(a_n)
+size(b_n)
+disp(b_n(1))
+C_n=sqrt(a_n.^2+(b_n).^2);
+theta_n(1)=0; theta_n=atan(-b_n,a_n);
+//n=[0,n];
+clf;
+size(n)
+subplot(2,2,1); plot2d3(n,a_n);xtitle('a_n','n');plot(n,a_n,'ro');
+subplot(2,2,2); plot2d3(n,b_n);xtitle('b_n','n');plot(n,b_n,'r.');
+subplot(2,2,3); plot2d3(n,C_n);xtitle('C_n','n');plot(n,C_n,'ro');
+subplot(2,2,4); plot2d3(n,theta_n,);xtitle('theta_n','n');plot(n,theta_n,'r.');
diff --git a/22/CH6/EX6.5/ch6ex5.jpg b/22/CH6/EX6.5/ch6ex5.jpg Binary files differnew file mode 100755 index 000000000..783da8bcd --- /dev/null +++ b/22/CH6/EX6.5/ch6ex5.jpg diff --git a/22/CH6/EX6.5/ch6ex5.sce b/22/CH6/EX6.5/ch6ex5.sce new file mode 100755 index 000000000..ca4a55e39 --- /dev/null +++ b/22/CH6/EX6.5/ch6ex5.sce @@ -0,0 +1,4 @@ +n=(-10:10); D_n=0.504./(1+ %i*4*n);
+clf;
+subplot(2,1,1); plot2d3(n,abs(D_n));
+subplot(2,1,2); plot2d3(n,atan(imag(D_n),real(D_n)));
diff --git a/22/CH6/EX6.7/ch6ex7.jpg b/22/CH6/EX6.7/ch6ex7.jpg Binary files differnew file mode 100755 index 000000000..8ea54c99f --- /dev/null +++ b/22/CH6/EX6.7/ch6ex7.jpg diff --git a/22/CH6/EX6.7/ch6ex7.sce b/22/CH6/EX6.7/ch6ex7.sce new file mode 100755 index 000000000..8613d11f1 --- /dev/null +++ b/22/CH6/EX6.7/ch6ex7.sce @@ -0,0 +1,24 @@ +//signals and systems
+//fourier series for train of impulses
+clear;
+close;
+clc;
+n=-3:1:3
+x = ones(1,length(n))
+D_n=ones(1,length(n));
+C_n=[0 0 0 1 2 2 2]
+subplot(3,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3(n,x)
+subplot(3,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3(n,D_n)
+subplot(3,1,3)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3(n,C_n); plot(n,C_n,'r.')
\ No newline at end of file diff --git a/22/CH6/EX6.9/ch6ex9.jpg b/22/CH6/EX6.9/ch6ex9.jpg Binary files differnew file mode 100755 index 000000000..ff41a56ae --- /dev/null +++ b/22/CH6/EX6.9/ch6ex9.jpg diff --git a/22/CH6/EX6.9/ch6ex9.sce b/22/CH6/EX6.9/ch6ex9.sce new file mode 100755 index 000000000..26968c514 --- /dev/null +++ b/22/CH6/EX6.9/ch6ex9.sce @@ -0,0 +1,4 @@ +n=(-10:10); D_n=2/(3.14*(1-4.*n.^2).*(%i*6.*n+1));
+clf;
+subplot(2,1,1); plot2d3(n,abs(D_n));
+subplot(2,1,2); plot2d3(n,atan(imag(D_n),real(D_n)));
diff --git a/22/CH7/EX7.1/ch7ex1.jpg b/22/CH7/EX7.1/ch7ex1.jpg Binary files differnew file mode 100755 index 000000000..5172fc6a0 --- /dev/null +++ b/22/CH7/EX7.1/ch7ex1.jpg diff --git a/22/CH7/EX7.1/ch7ex1.sce b/22/CH7/EX7.1/ch7ex1.sce new file mode 100755 index 000000000..7b4b53e73 --- /dev/null +++ b/22/CH7/EX7.1/ch7ex1.sce @@ -0,0 +1,31 @@ +//signals and systems
+//continuous time signal analysis the fourier transform
+//fourier transform of exp(-A*t)
+clear;
+clc;
+A =1; //Amplitude
+Dt = 0.005;
+t = -4.5:Dt:4.5;
+xt = exp(-A*abs(t));
+Wmax = 2*%pi*1; //Analog Frequency = 1Hz
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW = real(XW);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW = [mtlb_fliplr(XW), XW(2:1001)];
+subplot(2,1,1);
+a = gca();
+a.y_location = "origin";
+plot(t,xt);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+subplot(2,1,2);
+a = gca();
+a.y_location = "origin";
+plot(W,XW);
+xlabel('Frequency in Radians/Seconds W');
+ylabel('X(jW)')
+title('Continuous-time Fourier Transform')
diff --git a/22/CH7/EX7.12/ch7ex12.jpg b/22/CH7/EX7.12/ch7ex12.jpg Binary files differnew file mode 100755 index 000000000..c0a27630d --- /dev/null +++ b/22/CH7/EX7.12/ch7ex12.jpg diff --git a/22/CH7/EX7.12/ch7ex12.sce b/22/CH7/EX7.12/ch7ex12.sce new file mode 100755 index 000000000..af7d5cdff --- /dev/null +++ b/22/CH7/EX7.12/ch7ex12.sce @@ -0,0 +1,35 @@ +//signals and systems
+//Continuous Time Fourier Transform
+//Continuous Time Signal x(t)= exp(-A*abs(t))
+clear;
+clc;
+close;
+
+A =1; //Amplitude
+Dt = 0.005;
+t = -4.5:Dt:4.5;
+xt = exp(-A*abs(t));
+
+Wmax = 2*%pi*1; //Analog Frequency = 1Hz
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW = real(XW);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW = [mtlb_fliplr(XW), XW(2:1001)];
+subplot(1,1,1)
+subplot(2,1,1);
+a = gca();
+a.y_location = "origin";
+plot(t,xt);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+subplot(2,1,2);
+a = gca();
+a.y_location = "origin";
+plot(W,XW);
+xlabel('Frequency in Radians/Seconds W');
+ylabel('X(jW)')
+title('Continuous-time Fourier Transform')
\ No newline at end of file diff --git a/22/CH7/EX7.4/ch7ex4.jpg b/22/CH7/EX7.4/ch7ex4.jpg Binary files differnew file mode 100755 index 000000000..9df8b1a0d --- /dev/null +++ b/22/CH7/EX7.4/ch7ex4.jpg diff --git a/22/CH7/EX7.4/ch7ex4.sce b/22/CH7/EX7.4/ch7ex4.sce new file mode 100755 index 000000000..94bab37e4 --- /dev/null +++ b/22/CH7/EX7.4/ch7ex4.sce @@ -0,0 +1,27 @@ +//Example 4.5
+// Inverse Continuous Time Fourier Transform
+// impulse funtion
+clear;
+clc;
+close;
+// CTFT
+A =1; //Amplitude
+Dw = 0.005;
+W1 = 4; //Time in seconds
+w = -W1/2:Dw:W1/2;
+ for i=1:length(w)
+ XW(1)=1;
+ end
+XW = XW';
+
+//Inverse Continuous-time Fourier Transform
+t = -0.01:1/length(w):0.01;
+xt =(1/(2*%pi))*XW *exp(sqrt(-1)*w'*t)*Dw;
+xt = real(xt);
+figure
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(t,xt);
+xlabel(' t time in Seconds');
+title('Inverse Continuous Time Fourier Transform x(t)')
\ No newline at end of file diff --git a/22/CH7/EX7.5/ch7ex5.sce b/22/CH7/EX7.5/ch7ex5.sce new file mode 100755 index 000000000..1dfe343d1 --- /dev/null +++ b/22/CH7/EX7.5/ch7ex5.sce @@ -0,0 +1,27 @@ +//signals and systems
+// Inverse Continuous Time Fourier Transform
+// shifted impulse function
+clear;
+clc;
+close;
+w0=1
+A =1; //Amplitude
+Dw = 0.005;
+W1 = 4; //Time in seconds
+w = -W1/2:Dw:W1/2;
+XW=[zeros(1,length(w)/2) 1 zeros(1,length(w/2))];
+XW = XW';
+
+//Inverse Continuous-time Fourier Transform
+t = -0.01:1/length(w):0.01;
+size(XW)
+size(t)
+xt =(1/(2*%pi))*XW *exp(sqrt(-1)*w'.*t).*exp(sqrt(-1).*t)*Dw;
+xt = real(xt);
+figure
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(t,xt);
+xlabel(' t time in Seconds');
+title('Inverse Continuous Time Fourier Transform x(t)')
\ No newline at end of file diff --git a/22/CH7/EX7.6/ch7ex6.jpg b/22/CH7/EX7.6/ch7ex6.jpg Binary files differnew file mode 100755 index 000000000..3983d9166 --- /dev/null +++ b/22/CH7/EX7.6/ch7ex6.jpg diff --git a/22/CH7/EX7.6/ch7ex6.sce b/22/CH7/EX7.6/ch7ex6.sce new file mode 100755 index 000000000..e102336c1 --- /dev/null +++ b/22/CH7/EX7.6/ch7ex6.sce @@ -0,0 +1,25 @@ +//signals and systems
+// Continuous Time Fourier Transforms
+// Sinusoidal waveforms cos(Wot)
+clear;
+clc;
+close;
+
+T1 = 2;
+T = 4*T1;
+Wo = 2*%pi/T;
+W = [-Wo,0,Wo];
+ak = (2*%pi*Wo*T1/%pi)/sqrt(-1);
+XW = [-ak,0,ak];
+ak1 = (2*%pi*Wo*T1/%pi);
+XW1 =[ak1,0,ak1];
+
+figure
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',W,XW1,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel(' W');
+title('CTFT of cos(Wot)')
\ No newline at end of file diff --git a/22/CH7/EX7.7/ch7ex7.jpg b/22/CH7/EX7.7/ch7ex7.jpg Binary files differnew file mode 100755 index 000000000..1fbda1a1b --- /dev/null +++ b/22/CH7/EX7.7/ch7ex7.jpg diff --git a/22/CH7/EX7.7/ch7ex7.sce b/22/CH7/EX7.7/ch7ex7.sce new file mode 100755 index 000000000..280e02b3d --- /dev/null +++ b/22/CH7/EX7.7/ch7ex7.sce @@ -0,0 +1,29 @@ +//signals and systems
+// Continuous Time Fourier Transform of Symmetric
+// periodic Square waveform
+clear;
+clc;
+close;
+
+T1 = 2;
+T = 4*T1;
+Wo = 2*%pi/T;
+W = -%pi:Wo:%pi;
+delta = ones(1,length(W));
+XW(1) = (2*%pi*Wo*T1/%pi);
+mid_value = ceil(length(W)/2);
+for k = 2:mid_value
+ XW(k) = (2*%pi*sin((k-1)*Wo*T1)/(%pi*(k-1)));
+end
+figure
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',W(mid_value:$),XW,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',W(1:mid_value-1),XW($:-1:2),2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel('W in radians/Seconds');
+title('Continuous Time Fourier Transform of Periodic Square Wave')
\ No newline at end of file diff --git a/22/CH7/EX7.8/ch7ex8.jpg b/22/CH7/EX7.8/ch7ex8.jpg Binary files differnew file mode 100755 index 000000000..0e4779e5b --- /dev/null +++ b/22/CH7/EX7.8/ch7ex8.jpg diff --git a/22/CH7/EX7.8/ch7ex8.sce b/22/CH7/EX7.8/ch7ex8.sce new file mode 100755 index 000000000..d84d0056f --- /dev/null +++ b/22/CH7/EX7.8/ch7ex8.sce @@ -0,0 +1,32 @@ +//signals and systems
+//continuous time signal analysis the fourier transform
+// Periodic Impulse Train
+clear;
+clc;
+close;
+T = -4:4;;
+T1 = 1; //Sampling Interval
+xt = ones(1,length(T));
+ak = 1/T1;
+XW = 2*%pi*ak*ones(1,length(T));
+Wo = 2*%pi/T1;
+W = Wo*T;
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',T,xt,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel(' t');
+title('Periodic Impulse Train')
+subplot(2,1,2)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',W,XW,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel(' t');
+title('CTFT of Periodic Impulse Train')
\ No newline at end of file diff --git a/22/CH7/EX7.9/ch7ex9.jpg b/22/CH7/EX7.9/ch7ex9.jpg Binary files differnew file mode 100755 index 000000000..ffa0c49a8 --- /dev/null +++ b/22/CH7/EX7.9/ch7ex9.jpg diff --git a/22/CH7/EX7.9/ch7ex9.sce b/22/CH7/EX7.9/ch7ex9.sce new file mode 100755 index 000000000..2ece21f95 --- /dev/null +++ b/22/CH7/EX7.9/ch7ex9.sce @@ -0,0 +1,31 @@ +//signals and systems
+//continuous time signal analysis the fourier transform
+//fourier transform of unit step function u(t)
+clear;
+clc;
+A =0.000000001; //Amplitude
+Dt = 0.005;
+t = 0:Dt:4.5;
+xt = exp(-A*abs(t));
+Wmax = 2*%pi*1; //Analog Frequency = 1Hz
+K = 4;
+k = 0:(K/500):K;
+W = k*Wmax/K;
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW = real(XW);
+W = [-mtlb_fliplr(W), W(2:501)]; // Omega from -Wmax to Wmax
+XW = [mtlb_fliplr(XW), XW(2:501)];
+subplot(2,1,1);
+a = gca();
+a.y_location = "origin";
+plot(t,xt);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+subplot(2,1,2);
+a = gca();
+a.y_location = "origin";
+plot(W,XW);
+xlabel('Frequency in Radians/Seconds W');
+ylabel('X(jW)')
+title('Continuous-time Fourier Transform')
diff --git a/22/CH8/EX8.10/ch8ex10.jpg b/22/CH8/EX8.10/ch8ex10.jpg Binary files differnew file mode 100755 index 000000000..fab067071 --- /dev/null +++ b/22/CH8/EX8.10/ch8ex10.jpg diff --git a/22/CH8/EX8.10/ch8ex10.sce b/22/CH8/EX8.10/ch8ex10.sce new file mode 100755 index 000000000..281be40a6 --- /dev/null +++ b/22/CH8/EX8.10/ch8ex10.sce @@ -0,0 +1,25 @@ +//signals and systems
+// sampling: the bridge between continuous to discrete
+T_0 = 4;
+N_0 = 32;
+T = T_0/N_0;n = 0:N_0-1;r = n;
+x_n = [ones(1,4),0.5,zeros(1,23),0.5,ones(1,3)]';
+H_r = [ones(1,8),0.5,zeros(1,15),0.5,ones(1,7)]';
+X_r = fft(x_n,-1);
+Y_r = H_r .*(X_r);y_n = mtlb_ifft(Y_r);
+subplot(2,2,1);
+plot2d3(n,x_n);
+plot(n,x_n,'r.')
+xtitle('xn','n')
+subplot(2,2,2);
+plot2d3(r,real(X_r));
+plot(r,real(X_r),'ro')
+xtitle('Xr','r')
+subplot(2,2,3);
+plot2d3(n,real(y_n));
+plot(n,real(y_n),'r.')
+xtitle('yn','n')
+subplot(2,2,4);
+plot2d3(r,(X_r).*H_r);
+plot(r,(X_r).*H_r,'ro')
+xtitle('XrHr','r')
\ No newline at end of file diff --git a/22/CH8/EX8.8/ch8ex8.jpg b/22/CH8/EX8.8/ch8ex8.jpg Binary files differnew file mode 100755 index 000000000..990adb892 --- /dev/null +++ b/22/CH8/EX8.8/ch8ex8.jpg diff --git a/22/CH8/EX8.8/ch8ex8.sce b/22/CH8/EX8.8/ch8ex8.sce new file mode 100755 index 000000000..9061675c3 --- /dev/null +++ b/22/CH8/EX8.8/ch8ex8.sce @@ -0,0 +1,26 @@ +//signals and systems
+//sampling:the bridge from continuous to discrete
+//DFT to compute the fourier transform of e^-2t.u(t)
+T_0 = 4;
+N_0 = 256;
+T = T_0/N_0;
+t = (0:T:T*(N_0-1))';
+x = T*exp(-2*t);
+x = mtlb_i(x,1,(T*(exp(-2*T_0)+1))/2);
+X_r = fft(x);
+r = (-N_0/2:N_0/2-1)';
+omega_r = ((r*2)*%pi)/T_0;
+omega = linspace(-%pi/T,%pi/T,4097);
+X = 1 ./(%i*omega+2);
+subplot(2,1,1);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(omega,abs(X),"k",omega_r,fftshift(abs(X_r)),"ko");
+xtitle("magnitude of X(omega) for true FT and DFT");
+subplot(2,1,2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(omega,atan(imag(X),real(X)),"k",omega_r,fftshift(atan(imag(X_r),real(X_r))),"ko");
+xtitle("angle of X(omega) for true FT and DFT");
\ No newline at end of file diff --git a/22/CH8/EX8.9/ch8ex9.jpg b/22/CH8/EX8.9/ch8ex9.jpg Binary files differnew file mode 100755 index 000000000..16e0ae9c4 --- /dev/null +++ b/22/CH8/EX8.9/ch8ex9.jpg diff --git a/22/CH8/EX8.9/ch8ex9.sce b/22/CH8/EX8.9/ch8ex9.sce new file mode 100755 index 000000000..161d190e9 --- /dev/null +++ b/22/CH8/EX8.9/ch8ex9.sce @@ -0,0 +1,27 @@ +//signals and systems
+//sampling:the bridge from continuous to discrete
+//DFT to compute the fourier transform of 8rect(t)
+T_0 = 4;
+N_0 = 32;
+T = T_0/N_0;
+x_n = [ones(1,4) 0.5 zeros(1,23) 0.5 ones(1,3)]';
+size(x_n)
+x_r = fft(x_n);r = (-N_0/2:(N_0/2)-1)';
+omega_r = ((r*2)*%pi)/T_0;
+size(omega_r)
+size(omega)
+omega = linspace(-%pi/T,%pi/T,4097);
+X = 8*(sinc(omega/2));
+size(X)
+figure(1);
+subplot(2,1,1);
+plot(omega,abs(X),"k");
+plot(omega_r,fftshift(abs(x_r)),"ko")
+xtitle("angle of X(omega) for true FT and DFT");
+a=gca();
+subplot(2,1,2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot(omega,atan(imag(X),real(X)),"k",omega_r,fftshift(atan(imag(x_r),real(x_r))),'r.');
+xtitle("angle of X(omega) for true FT and DFT");
diff --git a/22/CH9/EX9.1/ch9ex1.jpg b/22/CH9/EX9.1/ch9ex1.jpg Binary files differnew file mode 100755 index 000000000..78a78ed13 --- /dev/null +++ b/22/CH9/EX9.1/ch9ex1.jpg diff --git a/22/CH9/EX9.1/ch9ex1.sce b/22/CH9/EX9.1/ch9ex1.sce new file mode 100755 index 000000000..44d7aafc0 --- /dev/null +++ b/22/CH9/EX9.1/ch9ex1.sce @@ -0,0 +1,21 @@ +//signals and systems
+//fourier analysis of discrete time signals
+//Example5.5:Discrete Time Fourier Transform:x[n]= sin(nWo)
+clear;
+clc;
+close;
+N = 0.1;
+Wo = %pi;
+W = [-Wo/10,0,Wo/10];
+XW =[0.5,0,0.5];
+//
+figure
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',W,XW,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xlabel(' W');
+title('DTFT of cos(nWo)')
+disp(Wo/10)
\ No newline at end of file diff --git a/22/CH9/EX9.10.a/ch9ex10.jpg b/22/CH9/EX9.10.a/ch9ex10.jpg Binary files differnew file mode 100755 index 000000000..67c59ac25 --- /dev/null +++ b/22/CH9/EX9.10.a/ch9ex10.jpg diff --git a/22/CH9/EX9.10.a/ch9ex10a.sce b/22/CH9/EX9.10.a/ch9ex10a.sce new file mode 100755 index 000000000..02c3a6aee --- /dev/null +++ b/22/CH9/EX9.10.a/ch9ex10a.sce @@ -0,0 +1,27 @@ +//signals and systems
+//discrete fourier transform
+//Frequency Shifting Property of DTFT
+clear;
+clc;
+close;
+mag = 4;
+W = -%pi/4:0.1:%pi/4;
+H1 = mag*ones(1,length(W));
+W1 =W+%pi/2;
+W2 = -W-%pi/2;
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+a.data_bounds=[-%pi,0;%pi,2];
+plot2d(W,H1);
+xtitle('Frequency Response of the given H(exp(jW))')
+subplot(2,1,2)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+a.data_bounds=[-2*%pi,0;2*%pi,2];
+plot2d(W1,0.5*H1);
+plot2d(W2,0.5*H1);
+xtitle('Frequency Response of modulated signal H1(exp(jW))')
\ No newline at end of file diff --git a/22/CH9/EX9.13/ch9ex13.sce b/22/CH9/EX9.13/ch9ex13.sce new file mode 100755 index 000000000..4d6122ff1 --- /dev/null +++ b/22/CH9/EX9.13/ch9ex13.sce @@ -0,0 +1,15 @@ +//LTi Systems characterized by Linear Constant +//fourier analysis of discrete systems +//Inverse Z Transform +//z = %z; +syms n z; +H1 = (-5/3)/(z-0.5); +H2 = (8/3)/(z-0.8); +F1 = H1*z^(n)*(z-0.5); +F2 = H2*z^(n)*(z-0.8); +h1 = limit(F1,z,0.5); +disp(h1,'h1[n]=') +h2 = limit(F2,z,0.8); +disp(h2,'h2[n]=') +h = h1-h2; +disp(h,'h[n]=')
\ No newline at end of file diff --git a/22/CH9/EX9.2/ch9ex2.jpg b/22/CH9/EX9.2/ch9ex2.jpg Binary files differnew file mode 100755 index 000000000..4fac4a0ec --- /dev/null +++ b/22/CH9/EX9.2/ch9ex2.jpg diff --git a/22/CH9/EX9.2/ch9ex2.sce b/22/CH9/EX9.2/ch9ex2.sce new file mode 100755 index 000000000..fbb10d839 --- /dev/null +++ b/22/CH9/EX9.2/ch9ex2.sce @@ -0,0 +1,13 @@ +N_0=32; n=(0:N_0-1);
+x_n= [ones(1,5) zeros(1,23) ones(1,4)];
+for r=0:31
+ X_r(r+1)=sum(x_n.*exp(-sqrt(-1)*r*2*3.14/N_0*n))/32;
+end
+subplot(2,1,1); r=n; plot2d3(r,real(X_r));
+xlabel('r'); ylabel('X_r');
+X_r=fft(x_n)/N_0;
+subplot(2,1,2);
+plot2d3(r,phasemag(X_r));
+xlabel('r'); ylabel('phase of X_r');
+disp(N_0,'period=')
+disp(2*%pi/N_0,'omega=')
diff --git a/22/CH9/EX9.3/ch9ex3.jpg b/22/CH9/EX9.3/ch9ex3.jpg Binary files differnew file mode 100755 index 000000000..f65fa44be --- /dev/null +++ b/22/CH9/EX9.3/ch9ex3.jpg diff --git a/22/CH9/EX9.3/ch9ex3.sce b/22/CH9/EX9.3/ch9ex3.sce new file mode 100755 index 000000000..ba15a7f29 --- /dev/null +++ b/22/CH9/EX9.3/ch9ex3.sce @@ -0,0 +1,67 @@ +//signals and systems
+//Discrete Time Fourier Transform of discrete sequence
+//x[n]= (a^n).u[n], a>0 and a<0
+clear;
+clc;
+close;
+// DTS Signal
+a1 = 0.5;
+a2 = -0.5;
+max_limit = 10;
+for n = 0:max_limit-1
+ x1(n+1) = (a1^n);
+ x2(n+1) = (a2^n);
+end
+n = 0:max_limit-1;
+// Discrete-time Fourier Transform
+Wmax = 2*%pi;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+x1 = x1';
+x2 = x2';
+XW1 = x1* exp(-sqrt(-1)*n'*W);
+XW2 = x2* exp(-sqrt(-1)*n'*W);
+XW1_Mag = abs(XW1);
+XW2_Mag = abs(XW2);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW1_Mag = [mtlb_fliplr(XW1_Mag), XW1_Mag(2:1001)];
+XW2_Mag = [mtlb_fliplr(XW2_Mag), XW2_Mag(2:1001)];
+[XW1_Phase,db] = phasemag(XW1);
+[XW2_Phase,db] = phasemag(XW2);
+XW1_Phase = [-mtlb_fliplr(XW1_Phase),XW1_Phase(2:1001)];
+XW2_Phase = [-mtlb_fliplr(XW2_Phase),XW2_Phase(2:1001)];
+//plot for a>0
+figure
+subplot(3,1,1);
+plot2d3('gnn',n,x1);
+xtitle('Discrete Time Sequence x[n] for a>0')
+subplot(3,1,2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW1_Mag);
+title('Magnitude Response abs(X(jW))')
+subplot(3,1,3);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW1_Phase);
+title('Phase Response <(X(jW))')
+//plot for a<0
+figure
+subplot(3,1,1);
+plot2d3('gnn',n,x2);
+xtitle('Discrete Time Sequence x[n] for a>0')
+subplot(3,1,2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW2_Mag);
+title('Magnitude Response abs(X(jW))')
+subplot(3,1,3);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW2_Phase);
+title('Phase Response <(X(jW))')
\ No newline at end of file diff --git a/22/CH9/EX9.3/ch9ex3b.jpg b/22/CH9/EX9.3/ch9ex3b.jpg Binary files differnew file mode 100755 index 000000000..1340e69f2 --- /dev/null +++ b/22/CH9/EX9.3/ch9ex3b.jpg diff --git a/22/CH9/EX9.4/ch9ex4.jpg b/22/CH9/EX9.4/ch9ex4.jpg Binary files differnew file mode 100755 index 000000000..05bcf666b --- /dev/null +++ b/22/CH9/EX9.4/ch9ex4.jpg diff --git a/22/CH9/EX9.4/ch9ex4.sce b/22/CH9/EX9.4/ch9ex4.sce new file mode 100755 index 000000000..2e5b1cfe0 --- /dev/null +++ b/22/CH9/EX9.4/ch9ex4.sce @@ -0,0 +1,43 @@ +//signals and systems
+//Discrete Time Fourier Transform of discrete sequence
+//x[n]= (a^n).u[-n], a>0 and a<0
+clear;
+clc;
+close;
+// DTS Signal
+a = 0.5;
+max_limit = 10;
+for n = 0:max_limit-1
+ x1(n+1) = (a^n);
+end
+n = 0:max_limit-1;
+// Discrete-time Fourier Transform
+Wmax = 2*%pi;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+x1 = x1';
+XW1 = x1* exp(-sqrt(-1)*n'*W);
+
+XW1_Mag = abs(XW1);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW1_Mag = [mtlb_fliplr(XW1_Mag), XW1_Mag(2:1001)];
+[XW1_Phase,db] = phasemag(XW1);
+XW1_Phase = [-mtlb_fliplr(XW1_Phase),XW1_Phase(2:1001)];
+//plot for a>0
+figure
+subplot(3,1,1);
+plot2d3('gnn',-n,x1);
+xtitle('Discrete Time Sequence x[n] for a>0')
+subplot(3,1,2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW1_Mag);
+title('Magnitude Response abs(X(jW))')
+subplot(3,1,3);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW1_Phase+%pi/2);
+title('Phase Response <(X(jW))')
\ No newline at end of file diff --git a/22/CH9/EX9.5/ch9ex5.jpg b/22/CH9/EX9.5/ch9ex5.jpg Binary files differnew file mode 100755 index 000000000..5c0c770da --- /dev/null +++ b/22/CH9/EX9.5/ch9ex5.jpg diff --git a/22/CH9/EX9.5/ch9ex5.sce b/22/CH9/EX9.5/ch9ex5.sce new file mode 100755 index 000000000..823bcb21a --- /dev/null +++ b/22/CH9/EX9.5/ch9ex5.sce @@ -0,0 +1,33 @@ +//signals and systems
+//Discrete Time Fourier Transform
+//x[n]= 1 , abs(n)<=N1
+clear;
+clc;
+close;
+// DTS Signal
+N1 = 2;
+n = -N1: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);
+W = [-mtlb_fliplr(W), W(2:1001)]; // Omega from -Wmax to Wmax
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+//plot for abs(a)<1
+figure
+subplot(2,1,1);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d3('gnn',n,x);
+xtitle('Discrete Time Sequence x[n]')
+subplot(2,1,2);
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+plot2d(W,XW_Mag);
+title('Discrete Time Fourier Transform X(exp(jW))')
\ No newline at end of file diff --git a/22/CH9/EX9.6/ch9ex6.jpg b/22/CH9/EX9.6/ch9ex6.jpg Binary files differnew file mode 100755 index 000000000..bde4a5758 --- /dev/null +++ b/22/CH9/EX9.6/ch9ex6.jpg diff --git a/22/CH9/EX9.6/ch9ex6.sce b/22/CH9/EX9.6/ch9ex6.sce new file mode 100755 index 000000000..68f49c1c5 --- /dev/null +++ b/22/CH9/EX9.6/ch9ex6.sce @@ -0,0 +1,33 @@ +//signals and systems
+//discreet time fourier series
+//IDTFT:Impulse Response of Ideal Low pass Filter
+clear;
+clc;
+close;
+Wc = 1; //1 rad/sec
+W = -Wc:0.1:Wc; //Passband of filter
+H0 = 1; //Magnitude of Filter
+HlpW = H0*ones(1,length(W));
+//Inverse Discrete-time Fourier Transform
+t = -2*%pi:2*%pi/length(W):2*%pi;
+ht =(1/(2*%pi))*HlpW *exp(sqrt(-1)*W'*t);
+ht = real(ht);
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+a.data_bounds=[-%pi,0;%pi,2];
+plot2d(W,HlpW,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xtitle('Frequency Response of LPF H(exp(jW))')
+subplot(2,1,2)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+a.data_bounds=[-2*%pi,-1;2*%pi,2];
+plot2d3('gnn',t,ht);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xtitle('Impulse Response of LPF h(t)')
\ No newline at end of file diff --git a/22/CH9/EX9.9/ch9ex9.jpg b/22/CH9/EX9.9/ch9ex9.jpg Binary files differnew file mode 100755 index 000000000..3bcf0f648 --- /dev/null +++ b/22/CH9/EX9.9/ch9ex9.jpg diff --git a/22/CH9/EX9.9/ch9ex9.sce b/22/CH9/EX9.9/ch9ex9.sce new file mode 100755 index 000000000..504f8bab2 --- /dev/null +++ b/22/CH9/EX9.9/ch9ex9.sce @@ -0,0 +1,39 @@ +//signals and systems
+//discreet time fourier series
+//IDTFT:Impulse Response of Ideal Low pass Filter
+clear;
+clc;
+close;
+Wc = 1; //1 rad/sec
+W = -Wc:0.1:Wc; //Passband of filter
+H0 = 1; //Magnitude of Filter
+HlpW = H0*ones(1,length(W));
+//Inverse Discrete-time Fourier Transform
+t = -2*%pi:2*%pi/length(W):2*%pi;
+ht1 =(1/(2*%pi))*HlpW *exp(sqrt(-1)*W'*t);
+size(ht1)
+n=-21:21;
+size(n)
+ht=ht1.*(%e^%i*2*t);
+ht = real(ht);
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+a.data_bounds=[-%pi,0;%pi,2];
+plot2d(W,HlpW,2);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xtitle('Frequency Response of LPF H(exp(jW))')
+subplot(2,1,2)
+a = gca();
+a.y_location ="origin";
+a.x_location ="origin";
+a.data_bounds=[-2*%pi,-1;2*%pi,2];
+size(t)
+size(ht)
+plot2d3('gnn',t,ht);
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+xtitle('Impulse Response of LPF h(t)')
\ No newline at end of file |