diff options
Diffstat (limited to '2294')
80 files changed, 2649 insertions, 0 deletions
diff --git a/2294/CH1/EX1.12/EX1_12.sce b/2294/CH1/EX1.12/EX1_12.sce new file mode 100755 index 000000000..e84599698 --- /dev/null +++ b/2294/CH1/EX1.12/EX1_12.sce @@ -0,0 +1,31 @@ +//Example 1.12<i>
+//check whether the given signal is periodic or not
+clc;
+t=-5:.01:5;
+x=%i*(exp(%i*5*t));
+subplot(311)
+plot(t,x);
+disp('(a)This shows that the given signal is periodic with priod(.4*%pi)');
+//Example 1.12<ii>
+//Show whether the given signal is periodic or not
+clc;
+t=-1/5:0.001:1/5;
+x=sin(50*%pi*t);
+subplot(312)
+plot(t,x);
+disp('(b)the plotting shows that the given signal is periodic with period 1/25');
+//Example 1.12.<iii>
+//Check whether the given signal is periodic or not
+clc;
+t=-1:0.01:1;
+x=20*cos((10*%pi*t)+(%pi/6));
+subplot(313)
+plot(t,x);
+disp('(c)Plot shows that the given signal is periodic with period .2');
+
+disp('In the figure we have the plots of part (a) - (c) in clockwise order strating from the top left')
+
+
+
+
+
diff --git a/2294/CH1/EX1.13/EX1_13.sce b/2294/CH1/EX1.13/EX1_13.sce new file mode 100755 index 000000000..861169ea1 --- /dev/null +++ b/2294/CH1/EX1.13/EX1_13.sce @@ -0,0 +1,38 @@ +//Example 1.13<i>
+//Check whether the given signal is periodic or not
+clc;
+t=-10:.01:10;
+y=2*cos(10*t+1)-sin(4*t-1);
+subplot(221)
+plot(t,y);
+disp('(a) The following signal is periodic with period %pi' );
+//Example 1.13<ii>
+//Show whether the given signal is periodic or not
+clc;
+t=-1:.01:1;
+x=cos(60*%pi*t)+sin(50*%pi*t);
+subplot(222)
+plot(t,x);
+disp('(b)Ther following figure shows that the given signal is periodic with the following period');
+//Example1.13<iv>
+//Check whether the given signal is periodic or not
+clc;
+t=-10:0.01:10;
+x=3*cos(4*t)+2*sin(%pi*t);
+subplot(223)
+plot(t,x);
+disp('(c)The signal is not periodic since ratio of two time periods is %pi/4 which is not rational number');
+//Example 1.13<V>
+//Check whether the given signal is periodic or not
+clc;
+t=0:10;
+for i=1:length(t)
+ u(i)=1;
+end
+x=u(i)-(1/2);
+subplot(224)
+plot(t,x);
+disp('(d)The signal is not periodic as seen from figure');
+
+disp('In the figure we have the plots of part (a) - (d) in clockwise order strating from the top left')
+
diff --git a/2294/CH1/EX1.14/EX1_14.sce b/2294/CH1/EX1.14/EX1_14.sce new file mode 100755 index 000000000..acc51a469 --- /dev/null +++ b/2294/CH1/EX1.14/EX1_14.sce @@ -0,0 +1,52 @@ +//Example 1.14<i>
+//Find whether the following signal is periodic or not
+clc;
+n=-10:10;
+x=cos(2*%pi*n);
+subplot(321)
+plot2d(n,x);
+f=(2*%pi)/(2*%pi);//where f is the no of cycles/sample.
+N=1/f;//where N is the no of samples per cycle.
+disp('samples',N,'(a)The given signal is periodic');
+//Example 1.14<ii>
+//Find whether the following signal is periodic or not.
+clc;
+n=-20:20;
+x=exp(%i*6*%pi*n);
+subplot(322)
+plot2d3(n,x);
+f=(6*%pi)/(2*%pi);//where f is the no of cycles per sample.
+N=1/f;//where N is the no of samples per cycle.
+disp('samples',N,'(b)the given signal is periodic');
+//example 1.14<1v>
+//Find whether the given signal is periodic or not
+clc;
+n=-30:30;
+x=exp(%i*(2*%pi/3)*n)+exp(%i*(3*%pi/4)*n);
+subplot(323)
+plot2d3(n,x);
+disp('(c)The given signal is periodic');
+//Example 1.14<v>
+//Find whether the given signal is periodic or not;
+clc;
+n=-20:20;
+x=exp(%i*(3*%pi/5)*(n+1/2));
+subplot(324)
+plot(n,x);
+f=(3*%pi/5)/(2*%pi);//where f is the no of cycles per sample.
+N=1/f;//where n is the no of samples per cycle.
+disp('samples',N,'(d)the given signal is periodic');
+//Example1.14<vi>
+//whether the given signal is periodic or not
+clc;
+n=-40:40;
+x=12*cos(20*n);
+subplot(325)
+plot(n,x);
+f=20/(2*%pi);//where f is the no of cycles per sample
+N=1/f;//where n is the no of sample per cycle
+disp('samples',N,'(e)the given signal is not peridic');
+
+disp('In the figure we have the plots of part (a) - (d) in clockwise order strating from the top left');
+
+
diff --git a/2294/CH1/EX1.15/EX1_15.sce b/2294/CH1/EX1.15/EX1_15.sce new file mode 100755 index 000000000..d73b35af7 --- /dev/null +++ b/2294/CH1/EX1.15/EX1_15.sce @@ -0,0 +1,34 @@ +//Example 1.15<i>
+//Find the even and odd components of the signal
+clc;
+clear;
+t=-10:.1:10;
+for j=1:length(t)
+ i=t(j);
+ x(j)=cos(i)+sin(i)+cos(i)*sin(i);
+ y(j)=cos(-i)+sin(-i)+cos(-i)*sin(-i);
+ e(j)=(1/2)*(x(j)+y(j));
+ o(j)=(1/2)*(x(j)-y(j));
+end
+disp('In the plot even component is in red and odd component is in blue')
+plot(t,e,'red')
+plot(t,o,'blue')
+//Example 1.15<ii>
+//Find the even and odd components of the signal
+clc;
+clear;
+n=-2:2;
+c=3;
+x=[-2 1 2 -1 3];
+for j=1:length(n)
+ i=n(j);
+ xe(j)=(1/2)*(x(c+i)+x(c-i));
+ xo(j)=(1/2)*(x(c+i)-x(c-i));
+end
+xe=[xe(c-2),xe(c-1),xe(c+0),xe(c+1),xe(c+2)];
+xo=[xo(c-2),xo(c-1),xo(c+0),xo(c+1),xo(c+2)];
+
+disp(xo,'odd component')
+disp(xe,'even component')
+
+
diff --git a/2294/CH1/EX1.16/EX1_16.sce b/2294/CH1/EX1.16/EX1_16.sce new file mode 100755 index 000000000..84f57ec22 --- /dev/null +++ b/2294/CH1/EX1.16/EX1_16.sce @@ -0,0 +1,11 @@ +//Example 1.16
+//Determine the power of the signal
+clc;
+A=2;
+theta=0;
+t=0:0.001:10;
+y=A*cos(2*%pi*t+theta);
+P=(integrate('A^2*(cos(2*%pi*t))^2','t',0,2*%pi))/(2*%pi);
+disp(P,'power of the signal is:');
+y=round(P);
+disp(y,'The given signal is power signal as power is finite');
diff --git a/2294/CH1/EX1.17/EX1_17.sce b/2294/CH1/EX1.17/EX1_17.sce new file mode 100755 index 000000000..806bf7ff6 --- /dev/null +++ b/2294/CH1/EX1.17/EX1_17.sce @@ -0,0 +1,35 @@ +//Example 1.17<i>
+//Determine the power and the rms value of the signal
+clc;
+t=0:0.001:10;
+y=5*cos(50*t+%pi/3);
+P=(integrate('5^2*(cos(50*t))^2','t',0,2*%pi))/(2*%pi);
+rmsvalue=sqrt(P);
+disp(P,'The power of the given signal is:');
+disp(rmsvalue,'the rms value is:');
+//Example 1.17<ii>
+//Determine the power amd rms value of the signal
+clc;
+t=0:0.001:10;
+x1=10*sin(50*t+%pi/4);
+x2=16*cos(100*t+%pi/3);
+P1=(integrate('10^2*(sin(50*t))^2','t',0,2*%pi))/(2*%pi);
+P2=(integrate('16^2*(cos(100*t))^2','t',0,2*%pi))/(2*%pi);
+P=P1+P2;
+rmsvalue=sqrt(P);
+disp(P,'The power of the given signal is:');
+disp(rmsvalue,'the rms value is:');
+//Example 1.17 <iii>
+//Determine the power and rms value of the signal
+clc;
+t=0:0.001:10;
+x1=5*cos(15*t);
+x2=5*cos(5*t);
+P1=(integrate('5^2*(cos(15*t))^2','t',0,2*%pi))/(2*%pi);
+P2=(integrate('5^2*(cos(5*t))^2','t',0,2*%pi))/(2*%pi);
+P=P1+P2;
+rmsvalue=sqrt(P);
+disp(P,'The power of the given signal is:');
+disp(rmsvalue,'the rms value is:');
+
+
diff --git a/2294/CH1/EX1.19.a/EX1_19.sce b/2294/CH1/EX1.19.a/EX1_19.sce new file mode 100755 index 000000000..770e948f4 --- /dev/null +++ b/2294/CH1/EX1.19.a/EX1_19.sce @@ -0,0 +1,11 @@ +//Example 1.19.1
+//whether the signal is energy signal or power signal
+clc ;
+ t =0:0.001:10;
+ y= exp (-10*t);
+ E= integrate ( ' ( exp(-10*t)) ^2 ' , ' t ' ,0 ,2* %pi );
+disp (E, ' Energy o f the s i g n a l i s ' );
+ disp ( 'since the energy is finite hence it is energy signal');
+ figure
+plot(t,y,'red');
+xtitle('Required figure');
diff --git a/2294/CH1/EX1.21/EX1_21.sce b/2294/CH1/EX1.21/EX1_21.sce new file mode 100755 index 000000000..2ecbd2b87 --- /dev/null +++ b/2294/CH1/EX1.21/EX1_21.sce @@ -0,0 +1,34 @@ +//Example 1.21<i>
+//whether the signal is energy signal
+clc ;
+ t =0:0.001:10;
+ y= exp (-3*t);
+ E= integrate ( ' ( exp(-3*t)) ^2 ' , ' t ' ,0 ,2* %pi );
+disp (E, ' Energy o f the s i g n a l i s ' );
+ disp ( 'since the energy is finite , hence it is energy signal');
+ //example1.21<iii>
+//show whethet x(t)=cost is a power or energy signal
+clc;
+t=0:0.01:100;
+x=cos(t);
+P=(integrate('cos(t)^2','t',0,2*%pi))/(2*%pi);
+disp(P,'The power of the signal is:');
+E=(integrate('cos(t)^2','t',0,2*%pi));
+disp(E,'The energy is:');
+disp('As t tends to infinity energy also tends to iinfinity but power remains finite.hence it is power signal');
+//Example 1.21<iv>
+//Find the energy of the signal
+clc;
+E=0;//initialize
+for n=0:200
+ x(n+1)=(1/3)^n;
+end
+for n=0:200
+ E=E+x(n+1)^2;
+end
+if E<%inf then
+ disp(E,'The energy of the signal is;');
+else disp('The given signal is not energy signal');
+end
+
+
diff --git a/2294/CH1/EX1.22/EX1_22.sce b/2294/CH1/EX1.22/EX1_22.sce new file mode 100755 index 000000000..977f731eb --- /dev/null +++ b/2294/CH1/EX1.22/EX1_22.sce @@ -0,0 +1,94 @@ +//Example 1.22<i>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+t=-10:10;
+a=.5;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;
+ else
+ x1(i)=exp(a.*t(i));
+ end
+end
+causal=%t;
+for i=1:length(t)
+ if t(i)<0 & x1(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+//Example 1.22<ii>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+t=-10:10;
+for i=1:length(t)
+ if t(i)>0 then
+ x2(i)=0;
+ else
+ x2(i)=exp(-2.*t(i));
+ end
+end
+causal=%t;
+for i=1:length(t)
+ if t(i)<0 & x2(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+//Example 1.22<iii>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+t=-10:10;
+c=2;
+for i=1:length(t)
+ x3(i)=sin(c.*t(i));
+ end
+causal=%t;
+for i=1:length(t)
+ if t(i)<0 & x3(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+//Example 1.22<iv>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+n=-10:10;
+for i=1:length(n)
+ if n(i)<-3 | n(i)>2 then
+ x1(i)=0;
+ else
+ x1(i)=1;
+ end
+ end
+causal=%t;
+for i=1:length(n)
+ if n(i)<0 & x1(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+//Example 1.22<v>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+n=-10:10;
+for i=1:length(n)
+ if n(i)>-2 then
+ x2(i)=(1/2)^n(i);
+ else
+ x2(i)=0;
+ end
+ end
+causal=%t;
+for i=1:length(n)
+ if n(i)<0 & x2(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+
diff --git a/2294/CH1/EX1.7/EX1_7.sce b/2294/CH1/EX1.7/EX1_7.sce new file mode 100755 index 000000000..b79864a65 --- /dev/null +++ b/2294/CH1/EX1.7/EX1_7.sce @@ -0,0 +1,44 @@ +//Example 1_7_<i>
+//Sketch the following signal.
+clc;
+clear all;
+t=-5:1/1000:5;
+for i=1:length(t)
+ if t(i)>1 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+end
+f=scf(0);
+plot2d(t,x);
+plot(t,x,'red');
+xtitle('Required figure','t','x(t)');
+xgrid();
+xs2jpg(0, 'problem1_7_i-plot.jpg');
+//Example 1_7_<ii>
+//Sketch the following signal.
+clc;
+t=-5:1/1000:5;
+for i=1:length(t)
+ if t(i)<1 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+end
+for i=1:length(t)
+ x1(i)=-2*x(i);
+end
+//figure
+f=scf(0);
+plot2d(t,x);
+xtitle('required figure','t','x(t)');
+xs2jpg(0, 'problem1.7.2-plot-a.jpg');
+//figure
+f=scf(1);
+plot2d(t,x1);
+plot(t,x1,'blue');
+xtitle('Required figure','t','x1(t)');
+xs2jpg(1, 'problem1.7.2-plot-b.jpg');
+
diff --git a/2294/CH1/EX1.8/EX1_8.sce b/2294/CH1/EX1.8/EX1_8.sce new file mode 100755 index 000000000..cb18627ca --- /dev/null +++ b/2294/CH1/EX1.8/EX1_8.sce @@ -0,0 +1,37 @@ +//Example 1.8.<i>
+//Sketch the following signal
+clc;
+clear all;
+t=-10:.001:10;
+for i=1:length(t)
+ if t(i)>=-2 & t(i)<3 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+//figure
+f=scf(0);
+plot2d(t,x);
+xtitle('Required figure','t','x(t)');
+xs2jpg(0, 'EX1_8_1-plot.jpg');
+//Example 1.8.<ii>
+//Sketch the following signal.
+clc;
+clear all;
+t=-10:.001:10;
+for i=1:length(t)
+ if t(i)>=0 & t(i)<=2 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+//figure
+f=scf(0);
+plot2d(t,x,1);
+xtitle('Required figure','t','x(t)');
+xs2jpg(0, 'EX1_8_2-plot.jpg');
+
+
+
diff --git a/2294/CH12/EX12.1/EX12_1.sce b/2294/CH12/EX12.1/EX12_1.sce new file mode 100755 index 000000000..5e4e2cd1b --- /dev/null +++ b/2294/CH12/EX12.1/EX12_1.sce @@ -0,0 +1,6 @@ +//Example 12.1
+//Show whether independent or not
+disp('Two events are independent if P(A and B)=P(A)P(B)')
+disp(0.28,'P(A and B)=')
+disp(0.8*0.35,'P(A)*P(B)=')
+disp('Hence A and B are independent')
diff --git a/2294/CH12/EX12.10/EX12_10.sce b/2294/CH12/EX12.10/EX12_10.sce new file mode 100755 index 000000000..74a97e031 --- /dev/null +++ b/2294/CH12/EX12.10/EX12_10.sce @@ -0,0 +1,9 @@ +//Example 12.10
+//find the required probabilities.
+disp('P(Plant shut down)=P(S1&S2&S3 is offline)or P(S1&S2 is offline)or P(S1&S3 are offline)=')
+p=(0.01)*(0.03)*(0.05)+(0.01)*(0.03)*(1-0.05)+(0.01)*(1-0.03)*(0.05)
+disp('(0.01)*(0.03)*(0.05)+(0.01)*(0.03)*(1-0.05)+(0.01)*(1-0.03)*(0.05)=')
+disp(p)
+disp(1-p,'P(Plant on line)=1-P(Plant shut down)=')
+disp('P(plant is online/S1 failed)=')
+disp((0.01)*(1-0.03)*(1-0.05)/0.01,'P(plant is online and S1 failed)/P(S1 failed)=(0.01)*(1-0.03)*(1-0.05)/0.01')
diff --git a/2294/CH12/EX12.11/EX12_11.sce b/2294/CH12/EX12.11/EX12_11.sce new file mode 100755 index 000000000..b454c110f --- /dev/null +++ b/2294/CH12/EX12.11/EX12_11.sce @@ -0,0 +1,11 @@ +//Exampple 12.11
+//Find the required probabilities.
+disp(0.45,'Let SS be the event that Ramesh pass in Signal and systems, P(SS)=')
+disp(0.32,'Let RP be the event that Ramesh pass in Random process P(RP)=')
+disp(0.15,'P(passed in both)=')
+disp('P(passed in either one subject)=P(SS U RP)')
+disp(0.45+0.32-0.15,'P(SS)+P(RP)-P(passed in both)=0.45+0.32-0.15=')
+disp(1-0.62,'P(passed in neither of the subjects)=1*P(passed in either subjects)=1-0.62=')
+disp('P( passed in one subject)=');
+disp(0.45*0.68+0.55*0.32,'P(SS)*P(failed in RP)+P(failed in SS)*P(RP)=(0.45)*(1-0.32)+(1-0.45)*(0.32)=')
+disp(1-0.45,'P(failed in SS)=1-P(SS)=1-0.45')
diff --git a/2294/CH12/EX12.12/EX12_12.sce b/2294/CH12/EX12.12/EX12_12.sce new file mode 100755 index 000000000..c30967e73 --- /dev/null +++ b/2294/CH12/EX12.12/EX12_12.sce @@ -0,0 +1,21 @@ +//Example 12.12
+//Find the required probabilities.
+disp('P(A occurs exactly k times in N trials)=(n C K)[P(A)]^k[1-P(A)]^(N-k)')
+disp('P(A)=1/6 P(~A)=5/6')
+funcprot(0)
+function c = combination ( n , r )
+c = prod ( n : -1 : n-r+1 )/ prod (1:r)
+endfunction
+disp('P( 3 shows up exactly twice in 6 trials)=(6 c 2)*(1/6)^2*(5/6)^4=')
+p=combination(6,2)*(1/6)^2*(5/6)^4;
+disp(p);
+disp('P(4 shows up atleast twice)=1-P(4 does not shows up)-P(4 shows up once)')
+disp('P(4 does not show up)=(6 c 0)*(1/6)^0*(5/6)^6=')
+p=combination(6,0)*(1/6)^0*(5/6)^6;
+disp(p);
+disp('P(4 shows up once)=(6 c 1)*(1/6)^1*(5/6)^5=')
+p=combination(6,1)*(1/6)^1*(5/6)^5;
+disp(p);
+disp('P(4 shows up atleast twice)=1-(5/6)^6-(5/6)^5=')
+p=1-(5/6)^6-(5/6)^5;
+disp(p);
diff --git a/2294/CH12/EX12.13/EX12_13.sce b/2294/CH12/EX12.13/EX12_13.sce new file mode 100755 index 000000000..7715d1e73 --- /dev/null +++ b/2294/CH12/EX12.13/EX12_13.sce @@ -0,0 +1,8 @@ +//Example 12.13
+//Find the required probabilities.
+disp('P(X>0.6)=1-F(0.6)=')
+disp(%e^(-1.2),'1-(1-e^(-1.2))=e^(-1.2)=')
+disp(1-%e^(-0.5),'P(X<=0.25)=(1-e^(2*(-1.2))=1-e^(-0.5)=')
+disp('P(0.4<X<=0.8)=F(0.8)-F(0.4)=')
+disp((1-%e^(-1.6))-(1-%e^(-0.8)),'(1-e^(-1.6))-(1-e^(-0.8))=')
+
diff --git a/2294/CH12/EX12.14/EX12_14.sce b/2294/CH12/EX12.14/EX12_14.sce new file mode 100755 index 000000000..83ec3857c --- /dev/null +++ b/2294/CH12/EX12.14/EX12_14.sce @@ -0,0 +1,7 @@ +//Example 12.14
+//Find the mean value of the current under following conditions.
+disp('I=Io[e^(nV)-1]')
+disp('E[I]=E[Io[e^(nV)-1]]:')
+Xo=0; X1=2;
+X=integrate('%e^(10*X)-1','X',Xo,X1);
+disp(10^(-9)*X/2,'Hence E[I]=')
diff --git a/2294/CH12/EX12.16/EX12_16.sce b/2294/CH12/EX12.16/EX12_16.sce new file mode 100755 index 000000000..11446cad5 --- /dev/null +++ b/2294/CH12/EX12.16/EX12_16.sce @@ -0,0 +1,15 @@ +//Example 12.16
+//Find the following.
+Xo=0;X1=1
+X=integrate('2*X*((1-X)^2)','X',Xo,X1)
+disp(X,'E[X]=')
+Xo=0;X1=1
+X2=integrate('2*X^2*((1-X)^2)','X',Xo,X1)
+disp(X2,'E[X^2]=')
+disp(6*X+3*(X2),'E[6X+3X^2]=6E[X]+3E[X^2]=')
+disp(2*X+3,'E[2*X+3]=2E[X]+3=')
+x1=2*X+3
+disp(4*X2+9+12*X,'E[(2*X+3)^2]=E[4*X^2+9+12*X]=')
+x2=4*X2+9+12*X
+disp(x2-x1^2,'Variance of (2*X+3)=E[(2*x+3)^2]-{E[2*X+3]}^2=')
+
diff --git a/2294/CH12/EX12.17/EX12_17.sce b/2294/CH12/EX12.17/EX12_17.sce new file mode 100755 index 000000000..ace1bdbbd --- /dev/null +++ b/2294/CH12/EX12.17/EX12_17.sce @@ -0,0 +1,7 @@ +//Example 12.17
+//Probablity that R lies between 110 and 120 ohm
+clc;
+X0=110;
+X1=120;
+X=integrate('1/(130-100)','X',X0,X1);
+disp(X,'The probability that R lies between 110 and 120 is :');
diff --git a/2294/CH12/EX12.18/EX12_18.sce b/2294/CH12/EX12.18/EX12_18.sce new file mode 100755 index 000000000..410769ac3 --- /dev/null +++ b/2294/CH12/EX12.18/EX12_18.sce @@ -0,0 +1,15 @@ +//Example 12.18
+//Find the mean and variance,if they exist.
+Xo=0;X1=1
+X=integrate('X*(X^3/12)','X',Xo,X1)
+disp(X,'E[X]=')
+Xo=0;X1=1
+X2=integrate('X^2*(X^3/12)','X',Xo,X1)
+disp(X2,'E[X^2]=')
+disp(X2-X^2,'Variance =E[X^2]-E[X]^2=')
+x=1:1:5;
+y=sum(x^2)/15;
+disp(y,'E[X]=sum(x*f(x))=sum(x^2)/15')
+y1=sum(x^3)/15;
+disp(y1,'E[X]=sum(x^2*f(x))=sum(x^3)/15')
+disp(y1-y^2,'Variance =E[X^2]-E[X]^2=')
diff --git a/2294/CH12/EX12.19/EX12_19.sce b/2294/CH12/EX12.19/EX12_19.sce new file mode 100755 index 000000000..3e9235d99 --- /dev/null +++ b/2294/CH12/EX12.19/EX12_19.sce @@ -0,0 +1,14 @@ +//Example 12.19
+//Find the required values.
+x=[0,0;8,8;8,0]
+y=[0,0;3,3;0,3]
+deff('z=f(x,y)','z=x/6')
+I=int2d(x,y,f)
+disp(I,'E[X]=')
+deff('z=f(x,y)','z=y/6')
+I=int2d(x,y,f)
+disp(I,'E[Y]=')
+deff('z=f(x,y)','z=x*y/6')
+I=int2d(x,y,f)
+disp(I,'E[XY]=')
+
diff --git a/2294/CH12/EX12.2/EX12_2.sce b/2294/CH12/EX12.2/EX12_2.sce new file mode 100755 index 000000000..da1a60c90 --- /dev/null +++ b/2294/CH12/EX12.2/EX12_2.sce @@ -0,0 +1,35 @@ +//Example 12.2
+//Find the probability of the problem.
+disp('The sample space in this case is:-');
+disp('(1,1) (1,2) (1,3) (1,4) (1,5) (1,6)');
+disp('(2,1) (2,2) (3,3) (4,4) (5,5) (6,6)');
+disp('(3,1) (2,2) (3,3) (4,4) (5,5) (6,6)');
+disp('(4,1) (2,2) (3,3) (4,4) (5,5) (6,6)');
+disp('(5,1) (2,2) (3,3) (4,4) (5,5) (6,6)');
+disp('(6,1) (2,2) (3,3) (4,4) (5,5) (6,6)');
+disp('Implies that N=36');
+disp('Let A be the event of sum 7' );
+disp('A={1,6} (2,5) (3,4) (4,3) (5,2) (6,1)} i.e n(A)=6' );
+p_a=6/36;
+disp(p_a,'Hence the probability of getting a sum 7 is p(A)=6/36=' );
+disp('Let B be the event of sum 11' );
+disp('A={5,6} (6,5) } i.e n(B)=2' );
+p_b=2/36;
+disp(p_b,'Hence the probability of getting a sum 2 is P(B)=2/36=' );
+disp('Let C be the event of sum 7 or 11' );
+disp('Probabilty of getting a sum of 7 or 11 ,P(C)=P(A)+P(B)' );
+p_c=p_a+p_b;
+disp(p_c,'Hence the probability of getting a sum 7 or 11 is P(C)=' );
+disp('Let D be the event of sum 3' );
+disp('A={1,2} (2,1)} i.e n(A)=2' );
+p_d=2/36;
+disp(p_d,'Hence the probability of getting a sum 3 is P(D)=2/36=' );
+disp('Let E be the event of sum 2 or 12' );
+disp('Probabilty of getting a sum of 2 or 12 ,P(E)=P(sum of 2)+P(sum of 12)' );
+disp('P(sum of 2)=1/36 P(sum of 12)=1/36')
+p_e=2/36;
+disp(p_e,'Hence the probability of getting a sum of 2 or 12 is P(E)=' );
+disp('Let F be the event of sum 2 or 3 0r 12' );
+disp('Probabilty of getting a sum of 2 or 3 or 12 ,P(F)=P(D)+P(E)' );
+p_f=p_d+p_e;
+disp(p_f,'Hence the probability of getting a sum 2 or 3 or 12 is P(F)=' );
diff --git a/2294/CH12/EX12.20/EX12_20.sce b/2294/CH12/EX12.20/EX12_20.sce new file mode 100755 index 000000000..49e3075a5 --- /dev/null +++ b/2294/CH12/EX12.20/EX12_20.sce @@ -0,0 +1,24 @@ +Xo=0;X1=1
+X=integrate('X*(X+0.5)','X',Xo,X1)
+disp(X,'E[X]=')
+Yo=0;Y1=1
+Y=integrate('Y*(Y+0.5)','Y',Yo,Y1)
+disp(Y,'E[Y]=')
+x=[0,0;1,1;1,0]
+y=[0,0;1,1;0,1]
+deff('z=f(x,y)','z=x*y*(x+y)')
+I=int2d(x,y,f)
+disp(I,'E[XY]=')
+disp(I-X*Y,'cov(X,Y)=E[XY]-E[X]E[Y]=');
+cov=I-X*Y
+Xo=0;X1=1
+X2=integrate('X^2*(X+0.5)','X',Xo,X1)
+disp(X2,'E[X^2]=')
+Yo=0;Y1=1
+Y2=integrate('Y^2*(Y+0.5)','Y',Yo,Y1)
+disp(Y2,'E[Y^2]=')
+disp(X2-X^2,'Variance of X=E[X^2]-E[X]^2)=')
+v1=X2-X^2
+disp(Y2-Y^2,'Variance of Y=E[Y^2]-E[Y]^2)=')
+v2=Y2-Y^2
+disp(cov/sqrt(v1*v2),'Correlation coefficient of X and Y=cov(X,Y)/(s.d of X*s.d of Y)=')
diff --git a/2294/CH12/EX12.3/EX12_3.sce b/2294/CH12/EX12.3/EX12_3.sce new file mode 100755 index 000000000..aa7aaf20e --- /dev/null +++ b/2294/CH12/EX12.3/EX12_3.sce @@ -0,0 +1,7 @@ +//Example12.3
+//Find the probability that tails shows up at least once.
+disp('Let A be the event that tail shows atleast once');
+disp('Eac toss has two possible outcmes H ,T');
+disp(2^3,'Hence the total no of outcomes is 2^3=');
+disp(1-(1/2^3),'P(A)=1-Probability of getting all head i.e 1/8=');
+
diff --git a/2294/CH12/EX12.4/EX12_4.sce b/2294/CH12/EX12.4/EX12_4.sce new file mode 100755 index 000000000..d6916b9ec --- /dev/null +++ b/2294/CH12/EX12.4/EX12_4.sce @@ -0,0 +1,15 @@ +//Example 12.4
+//Probability to find the required sample size.
+disp('Let A be the event of choosing a sample size of 6 containing two red, one green , two blue and one white blue ball.');
+funcprot(0)
+function c = combination ( n , r )
+c = prod ( n : -1 : n-r+1 )/ prod (1:r)
+endfunction
+disp('The number of combination of choosing 6 balls from 14 balls is 14 C 6 ways')
+disp('The number of combination of choosing 2 red balls from 4 balls is 4 C 2 ways')
+disp('The number of combination of choosing 1 from 3 green balls is 3 C 1 ways')
+disp('The number of combination of choosing 2 from 5 green balls is 5 C 2 ways')
+disp('The number of combination of choosing 1 from 2 white balls is 2 C 1 ways')
+disp('P(A)={(4 C 2)*(3 C 1)*(5 C 2)*(2 C 1)}/(14 C 6)=')
+p=(combination(4,2)*combination(3,1)*combination(5,2)*combination(2,1))/combination(14,6);
+disp(p);
diff --git a/2294/CH12/EX12.5/EX12_5.sce b/2294/CH12/EX12.5/EX12_5.sce new file mode 100755 index 000000000..3d2bed3a4 --- /dev/null +++ b/2294/CH12/EX12.5/EX12_5.sce @@ -0,0 +1,13 @@ +//Example 12.5
+//Probability to find the first white ball on the 3rd draw.
+disp('Let A be the event of drawing the first white ball at the third draw from 15 balls ')
+disp('Let W be the event of drawing a 10 white balls')
+disp('Let B be the event of drawing a 5 black balls')
+disp('Hence we have 1st draw :B 2nd Draw :B 3rd Draw :W');
+funcprot(0)
+function c = combination ( n , r )
+c = prod ( n : -1 : n-r+1 )/ prod (1:r)
+endfunction
+disp('P(A)={(5 C 1)*(5 C 1)*(10 C 1)}/{(15 C 1)*(15 C 1)*(15 C 1)}=')
+p=(combination(5,1)*combination(5,1)*combination(10,1))/(combination(15,1)*combination(15,1)*combination(15,1))
+disp(p)
diff --git a/2294/CH12/EX12.52/EX12_52.sce b/2294/CH12/EX12.52/EX12_52.sce new file mode 100755 index 000000000..4b428f7e9 --- /dev/null +++ b/2294/CH12/EX12.52/EX12_52.sce @@ -0,0 +1,5 @@ +//Example 12.52
+//Find the average power.
+Xo=-(4*%pi);X1=4*%pi
+X=integrate('(1-(X/(4*%pi)))','X',Xo,X1)
+disp(X/(4*%pi),'Average Power=')
diff --git a/2294/CH12/EX12.6/EX12_6.sce b/2294/CH12/EX12.6/EX12_6.sce new file mode 100755 index 000000000..14c4538c2 --- /dev/null +++ b/2294/CH12/EX12.6/EX12_6.sce @@ -0,0 +1,5 @@ +//Example 12.6
+//To find the required probabilities.
+disp(100/500,'P(1 kilo-ohms)=100/500=');
+disp(140/500,'P(20%)=140/500=');
+disp((125/500)/(260/500),'P(10%/10 kilo-ohms)={P(10%)&P(10 kilo-ohms)}/{P(10 kilo-ohms)}=(125/500)/(260/500)');
diff --git a/2294/CH12/EX12.7/EX12_7.sce b/2294/CH12/EX12.7/EX12_7.sce new file mode 100755 index 000000000..24092c305 --- /dev/null +++ b/2294/CH12/EX12.7/EX12_7.sce @@ -0,0 +1,7 @@ +//Example 12.7
+//find the required probabilities.
+disp(((1/2)*(1/2))+((2/3)*(1/2)),'P(PMOS is chosen)=(P{PMOS/4}/P{4})+(P{PMOS/3}/P{3})=((1/2)*(1/2))+((2/3)*(1/2))=');
+disp('Using Bayes Rule:')
+disp('P{4/NMOS}=P(NMOS/4)*P(4)/P(NMOS)=')
+disp('(1/2)*(1/2)/(1-(7/12))=')
+disp((1/2)*(1/2)/(1-(7/12)))
diff --git a/2294/CH12/EX12.8/EX12_8.sce b/2294/CH12/EX12.8/EX12_8.sce new file mode 100755 index 000000000..769d783c6 --- /dev/null +++ b/2294/CH12/EX12.8/EX12_8.sce @@ -0,0 +1,16 @@ +//Example 12.8
+//Find the given probabillities.
+disp('P{R1/So}=0.15 and P{Ro/S}=0.75');
+disp((1-0.15),'P{Ro/So}1-P{R1/So}');
+disp((1-0.075),'P{R1/S1}1-P{Ro/S1}');
+disp('P{R1}=P{R1/So}P(So)+P{R1/S1}P{S1}=');
+disp(((0.15)*(0.85)+(0.925)*(1-0.85)),'(0.15)(0.85)+(0.925)(1-0.85)=');
+disp('Using Bayes Rule:')
+disp('P{S1/R1}=(P{R1/S1}P{S0})/P{R0}=');
+p=(0.925*0.15/0.266)
+disp(p,'(0.925)(1-0.85)/0.266=');
+disp('P{Ro/So}P{So}/P{Ro}');
+disp('P{Ro/So}P{So}/(P{Ro/So}P{So}+P{Ro/S1}P{S1}=');
+p=(0.85)*(0.85)/((0.85)*(0.85)+(0.075)*(0.15))
+disp(p,'(0.85)(0.85)/((0.85)(0.85)+(0.075)(0.15))=');
+
diff --git a/2294/CH12/EX12.9/EX12_9.sce b/2294/CH12/EX12.9/EX12_9.sce new file mode 100755 index 000000000..fede892df --- /dev/null +++ b/2294/CH12/EX12.9/EX12_9.sce @@ -0,0 +1,11 @@ +//Example 12.9
+//Find the required probabilities.
+disp('Let H be the event that Husband is alive')
+disp('Let W be the event that wife is alive')
+disp('P(H)=0.85 P(W)=0.9')
+disp(0.85*0.9,'P(both alive)=P(H)P(W)=')
+disp(0.15*0.1,'P(neither alive)=(1-P(H))(1-P(W))=')
+disp(0.85+0.9-0.765,'P(Atleast one is alive)=P(H)+P(W)-P(both are alive)=')
+disp('P(only one is alive)=P(Husband is alive and wife is dead)OR P(Husband is dead and wife is alive)')
+disp('P(H)(1-P(W))+(1-P(H))P(W)=')
+disp((0.85)*(1-0.9)+(1-0.85)*(0.9),'(0.85)(1-0.9)+(1-0.85)(0.9)=')
diff --git a/2294/CH2/EX2.2/EX2_2.sce b/2294/CH2/EX2.2/EX2_2.sce new file mode 100755 index 000000000..ff901b05e --- /dev/null +++ b/2294/CH2/EX2.2/EX2_2.sce @@ -0,0 +1,51 @@ +//Example 2.2<i>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+n=10;x1(1)=1;x2(1)=1;
+for i=2:length(n)
+ x1(i)=i;
+ x2(i)=i-1;
+ y(i)=x1(i)+1 ./x2(i);
+ end
+causal=%t;
+for i=1:length(n)
+ if n(i)<0 &y(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+//Example 2.2<ii>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+n=10;x1(1)=1;x2(1)=-1;
+for i=2:length(n)
+ x1(i)=i;
+ x2(i)=i-2;
+ y(i)=x1(i).*x1(i)+x2(i);
+ end
+causal=%t;
+for i=1:length(n)
+ if n(i)<0 &y(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+//Example 2.2<vi>
+//Find whether the given signal is causal or not.
+clear all;
+clc;
+n=-10:10;
+for i=1:length(n)
+ x(i)=i;
+ y(i)=(i.^2);
+ end
+causal=%t;
+for i=1:length(n)
+ if n(i)<0 &y(i)~=0 then
+ causal=%f;
+ end
+end
+disp(causal,"The statement that the system is causal is:");
+
diff --git a/2294/CH2/EX2.3/EX2_3.sce b/2294/CH2/EX2.3/EX2_3.sce new file mode 100755 index 000000000..6df614b7a --- /dev/null +++ b/2294/CH2/EX2.3/EX2_3.sce @@ -0,0 +1,73 @@ +//Example 2.3<v>
+//Check whether the following signal is linear or not.
+clear;
+close;
+clc;
+T=20;//length of the signal
+A=5;
+B=4;
+for n=1:T
+ x(n)=n;
+ y(n)=A*x(n)+B;
+end
+x1=x;
+y1=y;
+for n=1:T
+ x2(n)=2;y2(n)=A*x2(n)+B;
+end
+z=y1+y2;
+for n=1:T
+ y3(n)=A*(x1(n)+x2(n))+B;
+end
+if z==y3 then
+ disp('The following signal is linear');
+else
+ disp('The following signal is non linear');
+end
+//Example 2.3<vi>
+//Check whether the following signal is linear or not.
+clear;
+close;
+clc;
+T=20;//length of the signal
+x1(1)=1;
+x2(1)=2;
+for n=2:T
+ x1(n)=n;
+ x2(n)=2*n;
+ y1(n)=(2*(x1(n)))+(1/x1(n-1));
+ y2(n)=(2*(x2(n)))+(1/x2(n-1));
+end
+z=y1+y2;
+for n=2:T
+ y3(n)=(2*(x1(n)+x2(n)))+(1/(x1(n-1)+x2(n-1)));
+end
+if z==y3 then
+ disp('The following signal is linear');
+else
+ disp('The following signal is non linear');
+end
+//Example 2.3<vii>
+//Check whether the following signal is linear or not.
+clear;
+close;
+clc;
+T=20;//length of the signal
+for n=1:T
+ x(n)=n;
+ y(n)=n*x(n);
+end
+x1=x;
+y1=y;
+for n=1:T
+ x2(n)=2;y2(n)=n*x2(n);
+end
+z=y1+y2;
+for n=1:T
+ y3(n)=n*(x1(n)+x2(n));
+end
+if z==y3 then
+ disp('The following signal is linear');
+else
+ disp('The following signal is non linear');
+end
diff --git a/2294/CH2/EX2.4/EX2_4.sce b/2294/CH2/EX2.4/EX2_4.sce new file mode 100755 index 000000000..d4bc27575 --- /dev/null +++ b/2294/CH2/EX2.4/EX2_4.sce @@ -0,0 +1,60 @@ +//Example 2.4<i>
+//Check whether the following signal is linear or not.
+clear;
+close;
+clc;
+T=20;//length of the signal
+for n=1:T
+ x1(n)=n;x2(n)=2*n;
+ y1(n)=exp(x1(n));
+ y2(n)=exp(x2(n));
+end
+z=y1+y2;
+for n=1:T
+ y3(n)=exp(x1(n)+x2(n));
+end
+if z==y3 then
+ disp('The following signal is linear');
+else
+ disp('The following signal is non linear');
+end
+//Example 2.4<ii>
+//Check whether the following signal is linear or not.
+clear;
+close;
+clc;
+T=20;//length of the signal
+for n=1:T
+ x1(n)=n;x2(n)=2*n;
+ y1(n)=x1(n)*x1(n);
+ y2(n)=x2(n)*x2(n);
+end
+z=y1+y2;
+for n=1:T
+ y3(n)=(x1(n)+x2(n))^2;
+end
+if z==y3 then
+ disp('The following signal is linear');
+else
+ disp('The following signal is non linear');
+end
+//Example 2.4<iii>
+//Check whether the following signal is linear or not.
+clear;
+close;
+clc;
+T=20;//length of the signal
+for n=1:T
+ x1(n)=n;x2(n)=2*n;
+ y1(n)=n^2*(x1(n));
+ y2(n)=n^2*(x2(n));
+end
+z=y1+y2;
+for n=1:T
+ y3(n)=n^2*(x1(n)+x2(n));
+end
+if z==y3 then
+ disp('The following signal is linear');
+else
+ disp('The following signal is non linear');
+end
diff --git a/2294/CH2/EX2.5/EX2_5.sce b/2294/CH2/EX2.5/EX2_5.sce new file mode 100755 index 000000000..338063db3 --- /dev/null +++ b/2294/CH2/EX2.5/EX2_5.sce @@ -0,0 +1,71 @@ +//Example 2.5<i>
+//Determine whether the following system is time invariant or not.
+clc;
+clear all;
+T=20;//length of the signal.
+s=2;//shift
+for n=1:T
+ x(n)=n;
+ y(n)=n*x(n);
+end
+IP=x(T-s);
+OP=y(T-s);
+if IP==OP then
+ disp('The given system is time invariant');
+else
+ disp('The given system is time variant');
+end
+//Example 2.5<ii>
+//Determine whether the following system is time invariant or not.
+clc;
+clear all;
+T=-10:10;//length of the signal.
+s=2;//shift
+for n=1:length(T)
+ x(n)=2;
+ y(n)=x(n)*cos(50*%pi.*T(n));
+end
+IP=x(T(n)-s);
+OP=y(T(n)-s);
+if IP==OP then
+ disp('The given system is time invariant');
+else
+ disp('The given system is time variant');
+end
+//Example 2.5<vi>
+//Determine whether the following signal is time invariant or not.
+clc;
+clear all;
+N=10;
+s=1//shift;
+k=2;
+for n=1:N
+ x(n)=n;
+end
+for n=1:(N/k)
+ y(n)=x(k*n);
+end
+ip=x(N-s);
+op=y((N/k)-s);
+if(ip==op) then
+ disp('the following signal is time invariant');
+else
+ disp('The given signal is time variant');
+//Example 2.5<vii>
+//Determine whether the following signal is time invariant or not.
+clc;
+clear all;
+T=20;
+s=4;//shift
+x(1)=1
+for n=2:T
+ x(n)=n;
+ y(n)=x(n-1).*x(n-1);
+end
+inputshift=x(T-s);
+outputshift=y(T-s);
+if (inputshift==outputshift) then
+ disp('The given signal is time invariant');
+else
+ disp('The given signal is time variant');
+end
diff --git a/2294/CH2/EX2.7/EX2_7.sce b/2294/CH2/EX2.7/EX2_7.sce new file mode 100755 index 000000000..966088cce --- /dev/null +++ b/2294/CH2/EX2.7/EX2_7.sce @@ -0,0 +1,82 @@ +//Check for the following system.
+//Example 2.7 <i>
+clc;
+clear ;//a>check whether static or dynamic
+t=-10:.1:10;T=length(t)
+s=2;
+for i=1:length(t)
+ x(i)=i;
+ y(i)=abs(x(i));
+end
+if y(2)==x(2)& y(2)==x(1) then
+ disp('The given signal is dynamic' );
+else
+ disp('the given signal is static');
+end
+//b>check whether linear or non linear
+x1=x;
+y1=y;
+for i=1:length(t)
+ x2(i)=-2;
+ y2(i)=abs(x2(i));
+end
+for i=1:length(t)
+z(i)=y1(i)+y2(i);
+end
+for i=1:length(t)
+ y3(i)=abs(x1(i)+x2(i));
+end
+if z==y3 then
+ disp('The given signal is linear');
+else
+ disp('Not linear');
+end
+//c>check whether time invariant or not
+IP=x(T-s);
+OP=y(T-s);
+if IP == OP then
+disp('the given signal is time invariant');
+else
+ disp('The given signal is not time invariant');
+ end
+//Check for the following systems
+//Example 2.7 <ii>
+clc;
+clear all;//a>check whether static or dynamic
+t=0:5;T=length(t);w=1;
+s=2;
+for i=1:length(t)
+ x(i)=i;
+ y(i)=x(i)*cos(w*t(i));
+end
+if y(2)==x(2)& y(2)==x(1) then
+ disp('The given signal is dynamic' );
+else
+ disp('the given signal is static');
+end
+//b>check whether linear or non linear
+x1=x;
+y1=y;
+for i=1:length(t)
+ x2(i)=2*i;
+ y2(i)=x2(i)*cos(w*t(i));
+ y3(i)=cos(w*t(i))*(x1(i)+x2(i));
+end
+z=y1+y2;
+if z~=y3 then
+ disp('The given signal is not linear');
+else
+ disp('linear');
+end
+//c>check whether time invariant or not
+IP=x(T-s);
+OP=y(T-s);
+if IP == OP then
+disp('the given signal is time invariant');
+else
+ disp('The given signal is not time invariant');
+ end
+
+
+
+
diff --git a/2294/CH3/EX3.13/EX3_13.sce b/2294/CH3/EX3.13/EX3_13.sce new file mode 100755 index 000000000..a30a6582e --- /dev/null +++ b/2294/CH3/EX3.13/EX3_13.sce @@ -0,0 +1,32 @@ +//example 3.13
+//Represent the sequence as sum of shifted unit impulse.
+clear ;
+ close ;
+ clc ;
+ t= -1:1:4;T=3;
+ x=[3 2 -1 2 4 1];
+ for i =1: length (t)
+ if modulo(t(i),3)==0 then
+ h(i)=1;
+else
+ h(i)=0;
+ end
+ end
+ y = convol(x,h);
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'problem38-plot-a.jpg');
+// figure
+f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t' , ' x ( t ) ' );
+ xs2jpg(1, 'problem38-plot-b.jpg');
+ //figure
+ f=scf(2);
+ a= gca ();
+ t1 =-2:1:8;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t) ' );
+ xs2jpg(2, 'problem38-plot-c.jpg');
diff --git a/2294/CH3/EX3.15/EX3_15.sce b/2294/CH3/EX3.15/EX3_15.sce new file mode 100755 index 000000000..9ef115090 --- /dev/null +++ b/2294/CH3/EX3.15/EX3_15.sce @@ -0,0 +1,7 @@ +//Example 3.15
+//Determine the convolution sum of two sequences.
+clc;
+x=[1 4 3 2];
+h=[1 3 2 1];
+y=convol(x,h);
+disp(y,'Convolution sum of the above two sequences is:");
\ No newline at end of file diff --git a/2294/CH3/EX3.16/EX3_16.sce b/2294/CH3/EX3.16/EX3_16.sce new file mode 100755 index 000000000..76db80bf5 --- /dev/null +++ b/2294/CH3/EX3.16/EX3_16.sce @@ -0,0 +1,7 @@ +//Example 3.16
+//Determine the output response.
+clc;
+x=[1 2 3 2];
+h=[1 2 2];
+y=convol(x,h);
+disp(y,'convolution of the above two sequences is:');
\ No newline at end of file diff --git a/2294/CH3/EX3.17/EX3_17.sce b/2294/CH3/EX3.17/EX3_17.sce new file mode 100755 index 000000000..45a6abcd7 --- /dev/null +++ b/2294/CH3/EX3.17/EX3_17.sce @@ -0,0 +1,6 @@ +//Example 3.17
+//Find the convolution of the sequences.
+x1=[1 -1 2 3];
+x2=[1 -2 3 -1];
+y=convol(x1,x2);
+disp(y,'The convolution of the above sequences is:');
\ No newline at end of file diff --git a/2294/CH3/EX3.18/EX3_18.sce b/2294/CH3/EX3.18/EX3_18.sce new file mode 100755 index 000000000..481182db0 --- /dev/null +++ b/2294/CH3/EX3.18/EX3_18.sce @@ -0,0 +1,7 @@ +//Example 3.18
+//Find the convolution.
+clc;
+x1=[1 -2 3 1];
+x2=[2 -3 -2];
+y=convol(x1,x2);
+disp(y,'The convolution of the above two sequences is:');
\ No newline at end of file diff --git a/2294/CH3/EX3.19/EX3_19.sce b/2294/CH3/EX3.19/EX3_19.sce new file mode 100755 index 000000000..9907631b5 --- /dev/null +++ b/2294/CH3/EX3.19/EX3_19.sce @@ -0,0 +1,6 @@ +//Example 3.19
+//Find the convolution of the following sequence.
+x=[2 -1 1 3];
+h=[3 4 2];
+y=convol(x,h);
+disp(y,'the convolution of the above sequence is:');
\ No newline at end of file diff --git a/2294/CH3/EX3.20/EX3_20.sce b/2294/CH3/EX3.20/EX3_20.sce new file mode 100755 index 000000000..bb6182ef2 --- /dev/null +++ b/2294/CH3/EX3.20/EX3_20.sce @@ -0,0 +1,34 @@ +//Example 3.20
+//Find the convolution of h(n)=a^n*u(n) and x(n)=b^n*u(n)
+clear;
+clc;
+close;
+n=-10:1/100:10;
+a=5;
+b=3;
+for i =1:length(n)
+ if n(i)<0 then
+ h(i)=0;
+ x(i)=0;
+ else
+ h(i)=a^n(i);
+ x(i)=b^n(i);
+ end;
+ end;
+ y=convol(h,x);
+// figure
+ f=scf(0);
+ plot(n,h,'black');
+ xtitle('input response1','n','h(n)');
+ xs2jpg(0, 'problem29-plot-a.jpg');
+// figure
+ f=scf(1);
+ plot(n,x,'red');
+ xtitle('input response2','n','x(n)');
+ xs2jpg(1, 'problem29-plot-b.jpg');
+ n1=-20:1/100:20;
+// figure
+ f=scf(2);
+ plot(n1,y,'green');
+ xtitle('output response','n1','y(n)');
+ xs2jpg(2, 'problem29-plot-c.jpg');
diff --git a/2294/CH3/EX3.21/EX3_21.sce b/2294/CH3/EX3.21/EX3_21.sce new file mode 100755 index 000000000..62f6d131b --- /dev/null +++ b/2294/CH3/EX3.21/EX3_21.sce @@ -0,0 +1,31 @@ +//Example 3.21
+//Determine the response of the below relaxed system.
+clc;
+close;
+ n=-10:.01:10;
+ for i=1:length(n)
+ if n(i)<0 then
+ h(i)=0;x(i)=0;
+ else
+ h(i)=(1/3)^n(i);
+ x(i)=2^n(i);
+ end
+ end
+ y=convol(h,x);
+ //figure
+ f=scf(0);
+ plot(n,h,'black');
+ xtitle('input response1','n','h(n)');
+ xs2jpg(0, 'problem29-plot-a.jpg');
+// figure
+f=scf(1);
+ plot(n,x,'red');
+ xtitle('input response2','n','x(n)');
+ xs2jpg(1, 'problem29-plot-b.jpg');
+// figure
+f=scf(2);
+ n1=-20:.01:20;
+ plot(n1,y,'green');
+ xtitle('output response','n','y(n)');
+ xs2jpg(2, 'problem29-plot-c.jpg');
+
diff --git a/2294/CH3/EX3.22/EX3_22.sce b/2294/CH3/EX3.22/EX3_22.sce new file mode 100755 index 000000000..cc82a830c --- /dev/null +++ b/2294/CH3/EX3.22/EX3_22.sce @@ -0,0 +1,33 @@ +//Example 3.22
+clear ;
+ close ;
+ clc ;
+ t = -5:1/100:5;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=0;
+ else
+ h(i)=1;
+ x(i)=1;
+ end
+ end
+ y = convol (x,h) ;
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'problem31-plot-a.jpg');
+ //figure
+ f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
+ xs2jpg(0, 'problem31-plot-b.jpg');
+ //figure
+ f=scf(2);
+ a= gca ();
+ t1 = -10:1/100:10;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
+ xs2jpg(0, 'problem31-plot-c.jpg');
+
diff --git a/2294/CH3/EX3.23/EX3_23.sce b/2294/CH3/EX3.23/EX3_23.sce new file mode 100755 index 000000000..f6de6134e --- /dev/null +++ b/2294/CH3/EX3.23/EX3_23.sce @@ -0,0 +1,107 @@ +//example 3.23<i>
+//Find the convolution sum
+clear ;
+ close ;
+ clc ;
+ t= -5:1/100:5;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=0;
+ else
+ h(i)=2^t(i);
+ x(i)=1;
+ end
+ end
+ y = convol (x,h) ;
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'problem32-plot-a.jpg');
+ //figure
+ f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t' , ' x ( t ) ' );
+ xs2jpg(1, 'problem32-plot-b.jpg');
+ //figure
+ f=scf(2);
+ a= gca ();
+ t1 = -10:1/100:10;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t) ' );
+ xs2jpg(2, 'problem32-plot-c.jpg');
+ //example 3.23<ii>
+//Find the response using convolution sum
+clear ;
+clc;
+ close ;
+ t = -5:1/100:5;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=0;
+ elseif t(i)<3 then
+ h(i)=0;
+ x(i)=1;
+ else h(i)=1;x(i)=1;
+ end
+ end
+ y = convol (x,h) ;
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'problem33-plot-a.jpg');
+ //figure
+f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
+ xs2jpg(1, 'problem33-plot-b.jpg');
+ //figure
+ f=scf(2);
+ a= gca ();
+ t1 = -10:1/100:10;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
+ xs2jpg(2, 'problem33-plot-c.jpg');
+//example 3.23<iii>
+//Find the response using convolution sum
+clear ;
+ close ;
+ clc ;
+ t = -5:1/100:5;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=0;
+ elseif t(i)<1 then
+ h(i)=0;
+ x(i)=1;
+elseif t(i)<=4 then h(i)=1;x(i)=1;
+elseif t(i)<=7 then
+ h(i)=0;
+ x(i)=1;
+ end
+ end
+ y = convol (x,h) ;
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'problem34-plot-a.jpg');
+// figure
+ f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
+ xs2jpg(1, 'problem34-plot-b.jpg');
+ //figure
+ f=scf(2);
+ t1 = -10:1/100:10;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
+ xs2jpg(2, 'problem34-plot-c.jpg');
+
+
+
+
diff --git a/2294/CH3/EX3.25/EX3_25.sce b/2294/CH3/EX3.25/EX3_25.sce new file mode 100755 index 000000000..5e1a42125 --- /dev/null +++ b/2294/CH3/EX3.25/EX3_25.sce @@ -0,0 +1,125 @@ +//Example 3.25<i>
+//Find whether the system is causal and stable.
+clear all;
+ clc ;
+ n = -5:5;
+ for i =1: length (n)
+ if(n(i) <=0)
+ h(i)= 2^n(i);
+ else
+ h(i)=0;
+ end
+ end
+ causal =%t;
+ for i =1: length (n)
+ if n(i) <0 & h(i) ~=0 then
+ causal =%f;
+ end
+ end
+ disp (causal,'The statement that the system is causal is:');
+ n =0:100000;
+ for i =1: length (n)
+ if(n(i) <=0)
+ h(i)= 2^n(i);
+ else
+ h(i)=0;
+ end
+ end
+ bibo =sum(h);
+ if (bibo < %inf ) then
+ disp (" system is bibo stable ");
+ else
+ disp (" systes not stable ");
+end
+//Example 3.25<ii>
+//Find whether the system is causal and stable.
+clear all;
+ clc ;
+ n = -5:5;
+ for i =1: length (n)
+ if(n(i) >=1)
+ h(i)= exp(2*n(i));
+ else
+ h(i)=0;
+ end
+ end
+ causal =%t;
+ for i =1: length (n)
+ if n(i) <0 & h(i) ~=0 then
+ causal =%f;
+ end
+ end
+ disp (causal,'The statement that the system is causal is:');
+ n =0:100000;
+ for i =1: length (n)
+ if(n(i) >=1)
+ h(i)= exp(2*n(i));
+ else
+ h(i)=0;
+ end
+ end
+ bibo =sum(h);
+ if (bibo < %inf ) then
+ disp (" system is bibo stable ");
+ else
+ disp (" system not stable ");
+ end
+//Example 3.25<iii>
+//Find whether the system is causal and stable.
+clear all;
+ clc ;
+ n = -5:5;
+ for i =1: length (n)
+ if(n(i) <=3)
+ h(i)= (5*n(i));
+ else
+ h(i)=0;
+ end
+ end
+ causal =%t;
+ for i =1: length (n)
+ if n(i) <0 & h(i) ~=0 then
+ causal =%f;
+ end
+ end
+ disp (causal,'The statement that the system is causal is:');
+ n =0:100000;
+ for i =1: length (n)
+ if(n(i) <=1)
+ h(i)= (5*n(i));
+ else
+ h(i)=0;
+ end
+ end
+ bibo =sum(h);
+ if (bibo < %inf ) then
+ disp (" system is bibo stable ");
+ else
+ disp (" system not stable ");
+ end
+//Example 3.2<iv>
+//Find whether the system is causal and stable.
+clear all;
+ clc ;
+ n = -5:5;
+ for i =1: length (n)
+ h(i)= exp(-6*abs(n(i)));
+ end
+ causal =%t;
+ for i =1: length (n)
+ if n(i) <0 & h(i) ~=0 then
+ causal =%f;
+ end
+ end
+ disp (causal,'The statement that the system is causal is:');
+ n =0:100000;
+ for i =1: length (n)
+ h(i)= exp(-6*abs(n(i)));
+ end
+ bibo =sum(h);
+ if (bibo < %inf ) then
+ disp (" system is bibo stable ");
+ else
+ disp (" system not stable ");
+ end
+
diff --git a/2294/CH3/EX3.26/EX3_26.sce b/2294/CH3/EX3.26/EX3_26.sce new file mode 100755 index 000000000..f731f886e --- /dev/null +++ b/2294/CH3/EX3.26/EX3_26.sce @@ -0,0 +1,133 @@ +//Find the step response.
+//Example 3.26<i>
+clear;
+close;
+clc;
+n=-5:.01:5;
+for i=1:length(n)
+ if n(i)==2 then
+ del1(i)=1;
+ del2(i)=0;
+ elseif n(i)==3 then
+ del1(i)=0;del2(i)=1;
+ else
+ del1(i)=0;del2(i)=0;
+ end
+ x1(i)=del1(i)+del2(i);
+ if n(i)<0 then
+ x2(i)=0;
+ else
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+//figure
+f=scf(0);
+plot(n,x1,'black');
+xtitle('Delta function as input');
+ xs2jpg(0, 'problem39-plot-a.jpg');
+//figure
+f=scf(1);
+plot(n,x2,'red');
+xtitle('Unit function as input');
+ xs2jpg(1, 'problem39-plot-b.jpg');
+//figure
+f=scf(2);
+n1=-10:.01:10;
+plot(n1,y,'green');
+xtitle('Step function as output');
+ xs2jpg(2, 'problem39-plot-c.jpg');
+//Example 3.26 <ii>
+//Find the step response.
+clc;
+clear;
+close;
+n=-5:.01:5;
+a=6;
+for i=1:length(n)
+ if n(i)<0 then
+ h(i)=0;x(i)=0;
+ else
+ h(i)=(-a)^n(i);
+ x(i)=1;
+ end
+end
+s=convol(h,x);
+//figure
+f=scf(0);
+plot(n,h,'red');
+xtitle('h(n)');
+ xs2jpg(0, 'problem40-plot-a.jpg');
+//figure
+f=scf(1);
+plot(n,x,'green');
+xtitle('x(n)');
+ xs2jpg(1, 'problem40-plot-b.jpg');
+//figure
+f=scf(2);
+n1=-10:.01:10;
+plot(n1,s,'blue');
+xtitle('s(n)');
+ xs2jpg(2, 'problem40-plot-c.jpg');
+//Example 3.26<iii>
+//Find the step response of the system.
+clc;
+clear;
+close;
+n=-5:.01:5;
+for i=1:length(n)
+ if n(i)<0 then
+ h(i)=0;x(i)=0;
+ else
+ h(i)=1;
+ x(i)=1;
+ end
+end
+s=convol(h,x);
+//figure
+f=scf(0);
+plot(n,h,'black');
+xtitle('h[n]');
+xs2jpg(0, 'problem41-plot-a.jpg');
+//figure
+f=scf(1);
+plot(n,x,'red');
+xtitle('x[n]');
+xs2jpg(1, 'problem41-plot-b.jpg');
+//figure
+f=scf(2);
+n1=-10:.01:10;
+plot(n1,s,'green');
+xtitle('s[n]');
+xs2jpg(2, 'problem41-plot-c.jpg');
+//Example 3.26 <iv>
+//Find the step response.
+clc;
+clear;
+close;
+n=-5:.01:5;
+for i=1:length(n)
+ if n(i)<0 then
+ h(i)=0;x(i)=0;
+ else
+ h(i)=((1/2)^n(i))+((-(1/3))^n(i));
+ x(i)=1;
+ end
+end
+s=convol(h,x);
+//figure
+f=scf(0);
+plot(n,h,'red');
+xtitle('h(n)');
+xs2jpg(0, 'problem42-plot-a.jpg');
+//figure
+f=scf(1);
+plot(n,x,'green');
+xtitle('x(n)');
+xs2jpg(1, 'problem42-plot-b.jpg');
+//figure
+f=scf(2);
+n1=-10:.01:10;
+plot(n1,s,'blue');
+xtitle('s(n)');
+xs2jpg(2, 'problem42-plot-c.jpg');
diff --git a/2294/CH3/EX3.27/Ex3_27.sce b/2294/CH3/EX3.27/Ex3_27.sce new file mode 100755 index 000000000..6a8f6cbad --- /dev/null +++ b/2294/CH3/EX3.27/Ex3_27.sce @@ -0,0 +1,104 @@ +//example 3.27<i>
+//Find the convolution sum
+clear ;
+clc;
+ close ;
+ t= -10:1/100:10;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=0;
+ else
+ h(i)=(1/2)^t(i);
+ x(i)=cos(%pi*t(i));
+ end
+ end
+ y = convol (x,h) ;
+// figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'EX3_27_1-plot-a.jpg');
+ //figure
+ f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t' , ' x ( t ) ' );
+ xs2jpg(1, 'EX3_27_1-plot-b.jpg');
+ //figure
+ f=scf(2);
+ t1 = -20:1/100:20;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t) ' );
+ xs2jpg(2, 'EX3_27_1-plot-c.jpg');
+//example 3.27<ii>
+//Find the response using convolution sum
+clear ;
+ close ;
+ clc ;
+ t = -10:1/100:10;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=(1/3)^(-t(i));
+ elseif t(i)==0 then
+ h(i)=0;
+ x(i)=0;
+ else h(i)=1;x(i)=0;
+ end
+ end
+ y = convol (x,h) ;
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'EX3_27_2-plot-a.jpg');
+ //figure
+ f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
+ xs2jpg(1, 'EX3_27_2-plot-b.jpg');
+ //figure
+ f=scf(2);
+ a= gca ();
+ t1 = -20:1/100:20;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
+ xs2jpg(2, 'EX3_27_2-plot-c.jpg');
+//example 3.27<iii>
+//Find the response using convolution sum
+clear ;
+ close ;
+ clc ;
+ t = -5:1/100:5;
+ for i =1: length (t)
+ if t(i) <0 then
+ h(i)=0;
+ x(i)=0;
+ elseif t(i)<=10 then
+ x(i)=(1/2)^t(i);
+ h(i)=1;
+else
+ h(i)=0;
+ x(i)=(1/2)^t(i);
+ end
+ end
+ y = convol (x,h) ;
+ //figure
+ f=scf(0);
+ plot2d (t,h)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
+ xs2jpg(0, 'EX3_27_3-plot-a.jpg');
+// figure
+f=scf(1);
+ plot2d (t,x)
+ xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
+ xs2jpg(1, 'EX3_27_3-plot-b.jpg');
+ //figure
+ f=scf(2);
+ a= gca ();
+ t1 = -10:1/100:10;
+ plot2d (t1 ,y)
+ xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
+ xs2jpg(2, 'EX3_27_3-plot-c.jpg');
+
+
diff --git a/2294/CH3/EX3.28/EX3_28.sce b/2294/CH3/EX3.28/EX3_28.sce new file mode 100755 index 000000000..f7ab5537c --- /dev/null +++ b/2294/CH3/EX3.28/EX3_28.sce @@ -0,0 +1,46 @@ +//Example 3.28
+//Find the convolution.
+clc;
+clear;
+close;
+n=-5:.01:5;
+for i=1:length(n)
+ if n(i)<0 then
+ x1(i)=0;
+ else
+ x1(i)=1;
+ end
+ if n(i)<3 then
+ x2(i)=0;
+ else
+ x2(i)=2;
+ end
+ if n(i)<6 then
+ x3(i)=0;
+ else
+ x3(i)=1;
+ end
+ x(i)=x1(i)-x2(i)+x3(i);
+ if n(i)<-2 | n(i)>9 then
+ h(i)=0;
+ else
+ h(i)=1;
+ end
+end
+y=convol(x,h);
+//figure
+f=scf(0);
+plot(n,h,'red');
+xtitle('h[n]');
+xs2jpg(0, 'problem43-plot-a.jpg');
+//figure
+f=scf(1);
+plot(n,x,'blue');
+xtitle('x[n]');
+xs2jpg(1, 'problem43-plot-b.jpg');
+//figure
+f=scf(2);
+n1=-10:.01:10;
+plot(n1,y,'green');
+xtitle('y[n]');
+xs2jpg(2, 'problem43-plot-c.jpg');
diff --git a/2294/CH3/EX3.31/EX3_31.sce b/2294/CH3/EX3.31/EX3_31.sce new file mode 100755 index 000000000..fb574dff7 --- /dev/null +++ b/2294/CH3/EX3.31/EX3_31.sce @@ -0,0 +1,7 @@ +//Example 3.31
+//Find the cross correlation of two finite length sequences.
+clc;
+x=[1 2 1 1];
+y=[1 2 1 1];
+z=convol(x,y);
+disp(z);
diff --git a/2294/CH3/EX3.32/EX3_32.sce b/2294/CH3/EX3.32/EX3_32.sce new file mode 100755 index 000000000..bd7c3aea1 --- /dev/null +++ b/2294/CH3/EX3.32/EX3_32.sce @@ -0,0 +1,12 @@ +//Example 3.32
+//Find the input signal
+clc;t=1:7;
+y=[1 5 10 11 8 4 1];
+h=[1 2 1 0 0 0 0];
+Y=fft(y,-1);//-1 is taken to obtain the fourier transform of y.
+H=fft(h,-1);
+
+X=Y./H;
+x=fft(X,1);//1 is taken to obtain the inverse fourier transform of X.
+s=round(x);
+disp(s,'The deconvolution of the above two sequences is :');
diff --git a/2294/CH3/EX6.0/EX_6.sce b/2294/CH3/EX6.0/EX_6.sce new file mode 100755 index 000000000..d04dd288b --- /dev/null +++ b/2294/CH3/EX6.0/EX_6.sce @@ -0,0 +1,38 @@ +//Example 6 0f question and answer section
+clc;
+clear; close;
+n=-5:.01:5;
+for i=1:length(n)
+ if n(i)<0 then
+ x(i)=0;h1(i)=0;h2(i)=0;
+ else
+ x(i)=1;h1(i)=2;h2(i)=3;
+ end
+ h3(i)=h1(i)+h2(i)//when in parallel
+ h4(i)=h1(i).*h2(i)//when in series
+end
+y1=convol(x,h3);
+y2=convol(x,h4);
+subplot(4,2,1);
+plot(n,x,'black');
+xtitle('x[n]');
+subplot(4,2,2);
+plot(n,h1,'red');
+xtitle('h1[n]');
+subplot(4,2,3);
+plot(n,h2,'red');
+xtitle('h2[n]');
+subplot(4,2,4);
+plot(n,h3,'blue');
+xtitle('h3[n]');
+subplot(4,2,5);
+plot(n,h4,'blue');
+xtitle('h4[n]');
+subplot(4,2,6);
+n1=-10:.01:10;
+plot(n1,y1,'green');
+xtitle('y1[n]');
+subplot(4,2,7);
+n1=-10:.01:10;
+plot(n1,y2,'green');
+xtitle('y2[n]');
diff --git a/2294/CH4/EX4.10/EX4_10.sce b/2294/CH4/EX4.10/EX4_10.sce new file mode 100755 index 000000000..21eaf7ff5 --- /dev/null +++ b/2294/CH4/EX4.10/EX4_10.sce @@ -0,0 +1,29 @@ +//Find the covolution Of the following signals.
+//Example 4.10
+clc;
+clear;
+close;
+t=-20:.01:20;
+for i=1:length(t)
+ if t(i)<0 | t(i)>2 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+ if t(i)>=10 then
+ h(i)=1;
+else
+ h(i)=0;
+end
+end
+y=convol(h,x);
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-40:.01:40;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.11/EX4_11.sce b/2294/CH4/EX4.11/EX4_11.sce new file mode 100755 index 000000000..de5b5bbf2 --- /dev/null +++ b/2294/CH4/EX4.11/EX4_11.sce @@ -0,0 +1,29 @@ +//Find the covolution Of the following signals.
+//Example 4.11
+clc;
+clear;
+close;
+t=-5:.01:5;
+for i=1:length(t)
+ if t(i)<0 | t(i)>2 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+ if t(i)<-1 | t(i)>2 then
+ h(i)=0;
+else
+ h(i)=2;
+end
+end
+y=convol(h,x);
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-10:.01:10;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.12/EX4_12.sce b/2294/CH4/EX4.12/EX4_12.sce new file mode 100755 index 000000000..7fb0f5ef8 --- /dev/null +++ b/2294/CH4/EX4.12/EX4_12.sce @@ -0,0 +1,62 @@ +//Find the covolution Of the following signals.
+//Example 4.12 <i>
+clc;
+clear;
+close;
+t=-5:.01:5;
+for i=1:length(t)
+ if t(i)>=0 & t(i)<=2 then
+ x(i)=sin(%pi*t(i));
+else
+ x(i)=0;
+ end
+if t(i)<1 | t(i)>3 then
+ h(i)=0;
+else
+ h(i)=1;
+end
+end
+y=convol(h,x);//convolution of the above two signals is done here.
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-10:.01:10;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
+//Find the covolution Of the following signals.
+//Example 4.12 <ii>
+clc;
+clear;
+close;
+t=-5:.01:5;
+for i=1:length(t)
+ if t(i)<0 then
+ x(i)=0;
+ elseif t(i)<1 then
+ x(i)=1+t(i);
+ elseif t(i)<2 then
+ x(i)=1-t(i);
+else
+ x(i)=0;
+end
+if t(i)<0 | t(i)>2 then
+ h(i)=0;
+else
+ h(i)=1;
+end
+end
+y=convol(h,x);
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-10:.01:10;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.4.2/EX4_4_2.sce b/2294/CH4/EX4.4.2/EX4_4_2.sce new file mode 100755 index 000000000..245736d8a --- /dev/null +++ b/2294/CH4/EX4.4.2/EX4_4_2.sce @@ -0,0 +1,25 @@ +//Example 4.4 <ii>
+//Find the step response of the following impulse response.
+clc;
+t=-1:.01:1;
+for i=1:length(t)
+ if t(i)==0 then
+ del1(i)=1;del2(i)=0;
+ elseif t(i)==1 then
+ del1(i)=0;del2(i)=1;
+ else
+ del1(i)=0;del2(i)=0;
+end
+h(i)=del1(i)-del2(i);
+if t(i)<0 then
+ u(i)=0;
+else
+ u(i)=1;
+end
+end
+s=convol(h,u);
+t1=-10:.05:10;
+f=scf(0);
+plot(t1,s,'red');
+xtitle('s[t]');
+xs2jpg(0, 'EX4_4_2-plot-a.jpg');
diff --git a/2294/CH4/EX4.6/EX4_6.sce b/2294/CH4/EX4.6/EX4_6.sce new file mode 100755 index 000000000..a8f932ae3 --- /dev/null +++ b/2294/CH4/EX4.6/EX4_6.sce @@ -0,0 +1,110 @@ +//Find the covolution Of the following signals.
+//Example 4.6<i>
+clc;
+clear;
+close;
+a=.5;
+b=.6;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=exp(-a.*t(i));
+ x2(i)=exp(-b.*t(i));
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_1-plot-a.jpg');
+//Find the covolution Of the following signals.
+//Example 4.6<ii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=1;
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_2-plot-a.jpg');
+//Find the covolution Of the following signals.
+//Example 4.6<iii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=t(i);
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_3-plot-a.jpg');
+//Find the covolution Of the following signals.
+//Example 4.6<iv>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=sin(t(i));
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_4-plot-a.jpg');
diff --git a/2294/CH4/EX4.7/EX4_7.sce b/2294/CH4/EX4.7/EX4_7.sce new file mode 100755 index 000000000..2e356f0c3 --- /dev/null +++ b/2294/CH4/EX4.7/EX4_7.sce @@ -0,0 +1,91 @@ +//Find the covolution Of the following signals.
+//Example 4.7<i>
+clc;
+clear;
+close;
+t=-4:.01:4;
+//Define signal h(t)=u(t+2)
+for i=1:length(t)
+ if t(i)<-2 then
+ h(i)=0;
+ else
+ h(i)=1;
+ end
+ //Define signal x(t)=exp^(-2*t)*u(t)
+ if t(i)<0 then
+ x(i)=0;
+else
+ x(i)=exp(-2.*t(i));
+end
+end
+y=convol(h,x);//convolution is done
+f=scf(0);
+subplot(3,1,1);
+plot(h,t,'red');
+xtitle('h[t]');
+subplot(3,1,2);
+plot(x,t,'blue');
+xtitle('x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'problem52-plot.jpg');
+//Find the covolution Of the following signals.
+//Example 4.7<iii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+//Define signal h(t)=u(t-2)
+for i=1:length(t)
+ if t(i)<-1 then
+ h(i)=0;
+ else
+ h(i)=1;
+ end
+ //Define signal x(t)=u(t+1)
+ if t(i)<2 then
+ x(i)=0;
+else
+ x(i)=1;
+end
+end
+y=convol(h,x);//The convolution is done here.
+subplot(3,1,1);
+plot(h,t,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(x,t,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
+//Find the covolution Of the following signals.
+//Example 4.7<ii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ x(i)=exp(-abs(t(i)));
+ if t(i)<-1 then
+ h(i)=0;
+ else
+ h(i)=exp(-2.*(t(i)+1)) ;
+ end
+ end
+y=convol(h,x);//Here convolution of the above two signals is done
+subplot(3,1,1);
+plot(h,t,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(x,t,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
+
+
diff --git a/2294/CH4/EX4.8/EX4_8.sce b/2294/CH4/EX4.8/EX4_8.sce new file mode 100755 index 000000000..ebacd9f56 --- /dev/null +++ b/2294/CH4/EX4.8/EX4_8.sce @@ -0,0 +1,29 @@ +//Find the covolution Of the following signals.
+//Example 4.8
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)>=0 & t(i)<=2 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+ if t(i)>=0 & t(i)<=3 then
+ h(i)=1;
+else
+ h(i)=0;
+end
+end
+y=convol(h,x);//Convolution of the above two signals is done.
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.9/EX4_9.sce b/2294/CH4/EX4.9/EX4_9.sce new file mode 100755 index 000000000..96a57d8ac --- /dev/null +++ b/2294/CH4/EX4.9/EX4_9.sce @@ -0,0 +1,31 @@ +//Find the covolution Of the following signals.
+//Example 4.9
+clc;
+clear;
+close;
+t=-10:.01:10;
+//input signal:x(t)=u(t-3)-u(t-5)
+for i=1:length(t)
+ if t(i)<3 | t(i)>5 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+ //h(t)=exp(-3*t)*u(t)
+ if t(i)>=0 then
+ h(i)=exp(-3.*t(i));
+else
+ h(i)=0;
+end
+end
+y=convol(h,x);//cconvolution of the above two signals
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-20:.01:20;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH7/EX7.1.1/EX7_1_1.sce b/2294/CH7/EX7.1.1/EX7_1_1.sce new file mode 100755 index 000000000..0fffdbe95 --- /dev/null +++ b/2294/CH7/EX7.1.1/EX7_1_1.sce @@ -0,0 +1,14 @@ +//Example 7.1.1
+//Find the laplace transform and Roc of the following signal
+clc;
+close;
+syms t;
+a=5;
+ x=exp(-a*t);
+b=6;c=7;
+s=b+c*%i;
+X=integrate((exp(-(a+s)*t)),'t',0,%inf);
+disp(X);
+disp(real(s));
+disp('Since real(s)>-a,so the integral converges');
+
diff --git a/2294/CH7/EX7.1.2/EX7_1_2.sce b/2294/CH7/EX7.1.2/EX7_1_2.sce new file mode 100755 index 000000000..2badede11 --- /dev/null +++ b/2294/CH7/EX7.1.2/EX7_1_2.sce @@ -0,0 +1,29 @@ +//Example 7_1_2
+//Find the laplace transform and Roc of the following signal.
+clc;
+t=-10:.01:10;
+a=4;
+for i=1:length(t)
+ if t(i)>0 then
+ x(i)=0;
+ else
+ x(i)=-exp(-a*t(i));
+ end
+end
+s=%s;
+numfs=1;
+denfs=s+.04;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+f=scf(0);
+subplot(2,1,1);
+plot2d(t,x,2);
+xtitle('Phrasing');
+xgrid;
+subplot(2,1,2);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+disp(fs);
+disp('As real(s)<-a,so the integral converges for real(s)<-a');
+xs2jpg(0, 'EX7_1_2-plot-a.jpg');
diff --git a/2294/CH7/EX7.11/EX7_11.sce b/2294/CH7/EX7.11/EX7_11.sce new file mode 100755 index 000000000..cfdf0668b --- /dev/null +++ b/2294/CH7/EX7.11/EX7_11.sce @@ -0,0 +1,27 @@ +//Example 7.11
+//Find the laplace transform .
+clc;
+t=-10:.01:10;
+for i=1:length(t)
+ if t(i)>=0 then
+ x(i)=exp(-2.*t(i))*sin(2*t(i));
+ else
+ x(i)=0;
+ end
+end
+s=%s;
+numfs=2;
+denfs=(s+2)^2+4;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+disp(fs);
+f=scf(0);
+subplot(2,1,1);
+plot2d(t,x,2);
+xtitle('Phrasing');
+xgrid;
+subplot(2,1,2);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+xs2jpg(0, 'problem109-plot-a.jpg');
diff --git a/2294/CH7/EX7.16/EX7_16.sce b/2294/CH7/EX7.16/EX7_16.sce new file mode 100755 index 000000000..cba9f452c --- /dev/null +++ b/2294/CH7/EX7.16/EX7_16.sce @@ -0,0 +1,41 @@ +//Example7.16.1
+//Find the laplace transform .
+clc;
+s=%s;t=-5:5;
+numfs=s^2+4*s+3;
+denfs=(s^2+4*s+5)^2;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+disp(fs);
+//Example7.16.2
+//Find the laplace transform .
+clc;
+s=%s;t=-5:5;
+numfs=s+3;
+denfs=(s^2+6*s+10);
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+f=scf(0);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+xs2jpg(0, 'EX7_16_2-plot-a.jpg');
+disp(fs);
+//Example7.16.3
+//Find the laplace transform .
+clc;
+s=%s;t=-5:5;
+numfs=(s+2)^2;
+denfs=(s^2+4*s+5)^2;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+disp(fs);
+
+
+
diff --git a/2294/CH7/EX7.2/EX7_2.sce b/2294/CH7/EX7.2/EX7_2.sce new file mode 100755 index 000000000..7f64c2933 --- /dev/null +++ b/2294/CH7/EX7.2/EX7_2.sce @@ -0,0 +1,12 @@ +//Example 7.2
+//Find the laplace transform and Roc of the following signal
+clc;
+close;
+syms t;
+ x=exp(-3*t)+exp(-2*t);
+b=6;c=7;
+s=b+c*%i;
+X=integrate((exp(-(3+s)*t))+(exp(-(2+s)*t)),'t',0,%inf);
+disp(X);
+disp(real(s));
+disp('Since real(s)>-2,so the integral converges');
diff --git a/2294/CH7/EX7.22/EX7_22.sce b/2294/CH7/EX7.22/EX7_22.sce new file mode 100755 index 000000000..9fa938870 --- /dev/null +++ b/2294/CH7/EX7.22/EX7_22.sce @@ -0,0 +1,32 @@ +//Example 7.22
+//Find the laplace transform .
+clc;
+t=-10:.01:10;
+for i=1:length(t)
+ y(i)=exp(-t(i))-2*exp(-2*t(i))+exp(-3*t(i));
+ x(i)=exp(-0.5*t(i));
+end
+s=%s;
+numfs1=1;
+denfs1=s+0.5;
+fs=syslin('c',numfs1/denfs1);
+numfs2=2;
+denfs2=(s+1)*(s+2)*(s+3);
+fs1=syslin('c',numfs2/denfs2);
+hs=fs1/fs;
+hs1=csim('impulse',t,hs);
+subplot(3,1,1);
+plot2d(t,x,2);
+xtitle('Phrasing');
+xgrid;
+subplot(3,1,2);
+plot2d(t,y,3);
+xtitle('Phrasing');
+xgrid;
+subplot(3,1,3);
+plot2d(t,hs1,1);
+xtitle('Solution');
+xgrid;
+disp(fs,'fs=:');
+disp(fs1,'fs1=:');
+disp(hs,'hs=:');
diff --git a/2294/CH7/EX7.3/EX7_3.sce b/2294/CH7/EX7.3/EX7_3.sce new file mode 100755 index 000000000..fa4a6bbe4 --- /dev/null +++ b/2294/CH7/EX7.3/EX7_3.sce @@ -0,0 +1,17 @@ +//Example 7.3
+//Find the laplace transform and Roc of the following signal
+clc;
+close;
+syms t;
+a=3;b1=-8;
+ x1=exp(-a*t);
+b=6;c=7;
+s=b+c*%i;
+X1=integrate((exp(-(a+s)*t)),'t',0,%inf);
+x2=exp(-2*t);
+X2=integrate((exp(-(b1+s)*t)),'t',-%inf,0);
+disp(X1);
+ disp(X2);
+X=X1+X2;disp(X);
+disp(real(s));
+disp('Since -a< real(s)>-b1,so the integral converges');
diff --git a/2294/CH7/EX7.4/EX7_4.sce b/2294/CH7/EX7.4/EX7_4.sce new file mode 100755 index 000000000..42825f0fb --- /dev/null +++ b/2294/CH7/EX7.4/EX7_4.sce @@ -0,0 +1,15 @@ +//Example 7.4
+//Find the laplace transform
+clc;
+close;
+syms t;
+b=4;
+ a=2;c=1;
+s=a+c*%i;
+X1=integrate((exp(-(b+s)*t)),'t',0,%inf);
+X2=integrate((exp(-(s-b)*t)),'t',-%inf,0);
+disp(X1);
+ disp(X2);
+X=X1+X2;disp(X)
+disp(real(s));
+disp('Since -b< real(s)<b,so the integral converges');
diff --git a/2294/CH7/EX7.5/EX7_5.sce b/2294/CH7/EX7.5/EX7_5.sce new file mode 100755 index 000000000..7754a3da5 --- /dev/null +++ b/2294/CH7/EX7.5/EX7_5.sce @@ -0,0 +1,28 @@ +//Example 7.5.2
+//Find the laplace transform of the following signal.
+clc;
+close;
+t=-10:.01:10;
+for i=1:length(t)
+ if t(i)>=0 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+s=%s;
+numfs=1;
+denfs=s;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+disp(fs);
+f=scf(0);
+subplot(2,1,1);
+plot2d(t,x,2);
+xtitle('Phrasing');
+xgrid;
+subplot(2,1,2);
+plot2d(t,fs1,1);
+xtitle('solution');
+xgrid;
+xs2jpg(0, 'EX7_5-plot-a.jpg');
diff --git a/2294/CH7/EX7.6/EX7_6.sce b/2294/CH7/EX7.6/EX7_6.sce new file mode 100755 index 000000000..0fab193b4 --- /dev/null +++ b/2294/CH7/EX7.6/EX7_6.sce @@ -0,0 +1,23 @@ +//Example 7.6
+//Find the laplace transform
+clc;
+t=-5:.05:5;
+w=2*%pi;
+x=cos(w*t);
+s=%s;
+numfs=s;
+denfs=s^2+w^2;
+fs=syslin('c',numfs/denfs);
+disp(fs);
+fs1=csim('impulse',t,fs);
+f=scf(0);
+subplot(2,1,1);
+plot2d(t,x,2);
+xtitle('Phrasing');
+xgrid;
+subplot(2,1,2);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+xs2jpg(0, 'EX7_6-plot-a.jpg');
+
diff --git a/2294/CH7/EX7.7/EX7_7.sce b/2294/CH7/EX7.7/EX7_7.sce new file mode 100755 index 000000000..99b74da9f --- /dev/null +++ b/2294/CH7/EX7.7/EX7_7.sce @@ -0,0 +1,40 @@ +//Example 7.7.1
+//Find the laplace transform of the following.
+clc;
+close;
+syms t,;
+ x=1;
+ a=2;c=1;
+ s=a+c*%i;
+X=integrate((exp(-s*t)),'t',2,%inf);
+ disp(X);
+//Example 7.7.2
+//Find the laplace transform .
+clc;
+t=-10:.01:10;
+for i=1:length(t)
+ if t(i)>=0 then
+ x(i)=(t(i)^2)*exp(-2*t(i));
+ else
+ x(i)=0;
+ end
+end
+s=%s;
+numfs=2;
+denfs=(s+2)^3;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+disp(fs);
+f=scf(0);
+subplot(2,1,1);
+plot2d(t,x,2);
+xtitle('Phrasing');
+xgrid;
+subplot(2,1,2);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+xs2jpg(0, 'EX7_7_2-plot-a.jpg');
+
+
+
diff --git a/2294/CH7/EX7.8/EX7_8.sce b/2294/CH7/EX7.8/EX7_8.sce new file mode 100755 index 000000000..c1b5aac57 --- /dev/null +++ b/2294/CH7/EX7.8/EX7_8.sce @@ -0,0 +1,14 @@ +//Example7.8
+//Find the laplace transform .
+clc;
+s=%s;t=-10:10;
+numfs=2*s;
+denfs=s^2-8;
+fs=syslin('c',numfs/denfs);
+fs1=csim('impulse',t,fs);
+f=scf(0);
+plot2d(t,fs1,1);
+xtitle('Solution');
+xgrid;
+xs2jpg(0, 'problem110-plot-a.jpg')
+disp(fs,'fs=');
diff --git a/2294/CH8/EX8.14/EX8_14.sce b/2294/CH8/EX8.14/EX8_14.sce new file mode 100755 index 000000000..f8a47fbc1 --- /dev/null +++ b/2294/CH8/EX8.14/EX8_14.sce @@ -0,0 +1,38 @@ +
+//Example 8.14
+//Find the convolution of the signals given below using fourier transform
+clc;
+clear all;
+n=-10:10;
+for i=1:length(n)
+ if n(i)>=0 then
+ x1(i)=(1/2)^n(i);
+ x2(i)=(1/3)^n(i);
+ else
+ x1(i)=0;
+ x2(i)=0;
+ end
+end
+subplot(3,2,1)
+plot(x1,n);
+xtitle('(a) x1(n)');
+subplot(3,2,2)
+plot(x2,n);
+xtitle('(b) x2(n)');
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+subplot(3,2,3)
+plot(X1,n);
+xtitle('(c) X1(n)');
+subplot(3,2,4)
+plot(X2,n);
+xtitle('(d) X2(n)');
+X3=X2.*X1;
+subplot(3,2,5)
+plot(X3,n);
+xtitle('(e) X3(n)');
+x3=fft(X3,1);
+disp(x3,'The result of convolution is:');
+subplot(3,2,6)
+plot(x3,n);
+xtitle('(f) x3(n)');
diff --git a/2294/CH8/EX8.19/EX8_19.sce b/2294/CH8/EX8.19/EX8_19.sce new file mode 100755 index 000000000..1d6b00c14 --- /dev/null +++ b/2294/CH8/EX8.19/EX8_19.sce @@ -0,0 +1,81 @@ +
+//Example 8.19.1
+//Use fourier transform to determine the response of the following signal
+clc;
+clear all;
+n=-10:10
+for i=1:length(n)
+ if n(i)>=1 then
+ x(i)=(3/4)^n(i);
+ h(i)=(1/2)^n(i);
+ else
+ x(i)=0;
+ h(i)=0;
+ end
+end
+subplot(3,2,1)
+plot(x,n);
+xtitle('(a)x(n)');
+subplot(3,2,2)
+plot(h,n);
+xtitle('(b)h(n)');
+X=fft(x,-1);
+H=fft(h,-1);
+subplot(3,2,3)
+plot(X,n);
+xtitle('(c)X(n)');
+subplot(3,2,4)
+plot(H,n);
+xtitle('(d)H(n)');
+Y=H.*X;
+subplot(3,2,5)
+plot(Y,n);
+xtitle('(e)Y(n)');
+y=fft(Y,1);
+disp(y,'The output response is:');
+subplot(3,2,6)
+plot(y,n);
+xtitle('(f)y(n)');
+
+
+clf()
+
+//Example 8.19.2
+//Use fourier transform to determine the response of the following signal
+clc;
+clear;
+n=-10:10
+for i=1:length(n)
+ if n(i)>=1 then
+ x(i)=(-1)^n(i);
+ h(i)=(1/2)^n(i);
+ else
+ x(i)=0;
+ h(i)=0;
+ end
+end
+subplot(3,2,1)
+plot(x,n);
+xtitle('x(n)');
+subplot(3,2,2)
+plot(h,n);
+xtitle('h(n)');
+X=fft(x,-1);
+H=fft(h,-1);
+subplot(3,2,3)
+plot(X,n);
+xtitle('X(n)');
+subplot(3,2,4)
+plot(H,n);
+xtitle('H(n)');
+Y=H.*X;
+subplot(3,2,5)
+plot(Y,n);
+xtitle('Y(n)');
+y=fft(Y,1);
+disp(y,'The output response is:');
+subplot(3,2,6)
+plot(y,n);
+xtitle('y(n)');
+
+
diff --git a/2294/CH8/EX8.25/EX8_25.sce b/2294/CH8/EX8.25/EX8_25.sce new file mode 100755 index 000000000..09e88f072 --- /dev/null +++ b/2294/CH8/EX8.25/EX8_25.sce @@ -0,0 +1,12 @@ +//Example 8.25.1
+//Find idft of the following
+clc;
+X=[1 1-%i*2 -1 1+%i*2];
+x=fft(X,1);
+disp(x);
+//Example 8.25.2
+//Find idft of the following
+clc;
+X=[1 0 1 0];
+x=fft(X,1);
+disp(x);
diff --git a/2294/CH8/EX8.26/EX8_26.sce b/2294/CH8/EX8.26/EX8_26.sce new file mode 100755 index 000000000..a58de6312 --- /dev/null +++ b/2294/CH8/EX8.26/EX8_26.sce @@ -0,0 +1,12 @@ + +//Example 8.26
+//Find the circular convolution of two sequences
+clc;
+clear all;
+x1=[1 2 3 4];
+x2=[1 -1 2 1];
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+X3=X1.*X2;
+x3=fft(X3,1);
+disp(x3,'The circular convolution is:');
diff --git a/2294/CH8/EX8.27/EX8_27.sce b/2294/CH8/EX8.27/EX8_27.sce new file mode 100755 index 000000000..15af19547 --- /dev/null +++ b/2294/CH8/EX8.27/EX8_27.sce @@ -0,0 +1,12 @@ +
+//Example 8.27
+//Find the circular convolution of the following sequences
+clc;
+clear all;
+x1=[1 -1 2 3];
+x2=[0 1 2 3];
+X1=fft(x1,-1);//To obtain fourier transform of x1, -1 is taken.
+X2=fft(x2,-1);
+X3=X1.*X2;
+x3=fft(X3,1);//+1 to obtain inverse fourier transform.
+disp(x3,'Circular convolution of the above two sequences is:');
diff --git a/2294/CH8/EX8.28/EX8_28.sce b/2294/CH8/EX8.28/EX8_28.sce new file mode 100755 index 000000000..8821bc42c --- /dev/null +++ b/2294/CH8/EX8.28/EX8_28.sce @@ -0,0 +1,16 @@ + +//Example 8.28
+//Find the linear and circular convolution
+clc;
+clear all;
+x1=[1 2 3 4];
+x2=[2 3 4 1];
+//Linear convolution
+z=convol(x1,x2);
+disp(z,'The linear convolution is:');
+//To obtain circular convolution
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+X3=X1.*X2;
+x3=fft(X3,1);
+disp(x3,'The circular convolution is:');
diff --git a/2294/CH8/EX8.29/EX8_29.sce b/2294/CH8/EX8.29/EX8_29.sce new file mode 100755 index 000000000..35ac651ad --- /dev/null +++ b/2294/CH8/EX8.29/EX8_29.sce @@ -0,0 +1,36 @@ +//Find dft of the following sequence
+//Example 8.29.1
+clc;
+n=-10:10;
+for i=1:length(n)
+ if n(i)==0 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+y=fft(x,-1);
+disp(y,'The dft of the sequence is:');
+//Find dft of the following sequence
+//Example 8.29.2
+clc;
+n=-10:10;n0=2;
+for i=1:length(n)
+ if n(i)==n0 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+y=fft(x,-1);
+disp(y,'The dft of the sequence is:');
+//Find dft of the following sequence
+//Example 8.29.3
+clc;
+n=-10:10;a=2;
+for i=1:length(n)
+ x(i)=a^n(i);
+end
+y=fft(x,-1);
+disp(y,'The dft of the sequence is:');
+
|