From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 2294/CH1/EX1.12/EX1_12.sce | 31 +++++++++++++++ 2294/CH1/EX1.13/EX1_13.sce | 38 ++++++++++++++++++ 2294/CH1/EX1.14/EX1_14.sce | 52 ++++++++++++++++++++++++ 2294/CH1/EX1.15/EX1_15.sce | 34 ++++++++++++++++ 2294/CH1/EX1.16/EX1_16.sce | 11 ++++++ 2294/CH1/EX1.17/EX1_17.sce | 35 +++++++++++++++++ 2294/CH1/EX1.19.a/EX1_19.sce | 11 ++++++ 2294/CH1/EX1.21/EX1_21.sce | 34 ++++++++++++++++ 2294/CH1/EX1.22/EX1_22.sce | 94 ++++++++++++++++++++++++++++++++++++++++++++ 2294/CH1/EX1.7/EX1_7.sce | 44 +++++++++++++++++++++ 2294/CH1/EX1.8/EX1_8.sce | 37 +++++++++++++++++ 11 files changed, 421 insertions(+) create mode 100755 2294/CH1/EX1.12/EX1_12.sce create mode 100755 2294/CH1/EX1.13/EX1_13.sce create mode 100755 2294/CH1/EX1.14/EX1_14.sce create mode 100755 2294/CH1/EX1.15/EX1_15.sce create mode 100755 2294/CH1/EX1.16/EX1_16.sce create mode 100755 2294/CH1/EX1.17/EX1_17.sce create mode 100755 2294/CH1/EX1.19.a/EX1_19.sce create mode 100755 2294/CH1/EX1.21/EX1_21.sce create mode 100755 2294/CH1/EX1.22/EX1_22.sce create mode 100755 2294/CH1/EX1.7/EX1_7.sce create mode 100755 2294/CH1/EX1.8/EX1_8.sce (limited to '2294/CH1') 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 +//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 +//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. +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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 +//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_ +//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_ +//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. +//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. +//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'); + + + -- cgit