diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /67/CH2 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '67/CH2')
-rwxr-xr-x | 67/CH2/EX2.1/example21.sce | 18 | ||||
-rwxr-xr-x | 67/CH2/EX2.17.a/example217a.sce | 5 | ||||
-rwxr-xr-x | 67/CH2/EX2.17.b/example217b.sce | 5 | ||||
-rwxr-xr-x | 67/CH2/EX2.17.c/example217c.sce | 5 | ||||
-rwxr-xr-x | 67/CH2/EX2.19.a/example219a.sce | 32 | ||||
-rwxr-xr-x | 67/CH2/EX2.19.b/example219b.sce | 30 | ||||
-rwxr-xr-x | 67/CH2/EX2.2/example22.sce | 24 | ||||
-rwxr-xr-x | 67/CH2/EX2.21.a/example221a.sce | 30 | ||||
-rwxr-xr-x | 67/CH2/EX2.21.b/example221b.sce | 30 | ||||
-rwxr-xr-x | 67/CH2/EX2.25/example225.sce | 30 | ||||
-rwxr-xr-x | 67/CH2/EX2.3/example23.sce | 25 | ||||
-rwxr-xr-x | 67/CH2/EX2.4/example24.sce | 18 | ||||
-rwxr-xr-x | 67/CH2/EX2.5/example25.sce | 27 | ||||
-rwxr-xr-x | 67/CH2/EX2.59/example259.sce | 32 | ||||
-rwxr-xr-x | 67/CH2/EX2.6/example26.sce | 24 | ||||
-rwxr-xr-x | 67/CH2/EX2.7/example27.sce | 18 | ||||
-rwxr-xr-x | 67/CH2/EX2.8/example28.sce | 23 |
17 files changed, 376 insertions, 0 deletions
diff --git a/67/CH2/EX2.1/example21.sce b/67/CH2/EX2.1/example21.sce new file mode 100755 index 000000000..5d6412394 --- /dev/null +++ b/67/CH2/EX2.1/example21.sce @@ -0,0 +1,18 @@ +//Example 2.1
+clc;
+t=-8:1/100:8;
+for i=1:length(t)
+ x(i)=exp(-t(i)^2);
+ h(i)=3*t(i)^2;
+end
+y=convol(x,h);
+figure
+plot2d(t,h);
+title('Impulse responce');
+figure
+plot2d(t,x);
+title('Input signal');
+figure
+t2=-16:1/100:16
+plot2d(t2,y);
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.17.a/example217a.sce b/67/CH2/EX2.17.a/example217a.sce new file mode 100755 index 000000000..3407e0d66 --- /dev/null +++ b/67/CH2/EX2.17.a/example217a.sce @@ -0,0 +1,5 @@ +//Example 2.17a
+clc;
+disp(' y[n]=3x[n-2]+3x[n+2] ');
+disp('THE GIVEN SYSTEM IS NON-CAUSAL');
+disp('Since the value of output depends on future input');
\ No newline at end of file diff --git a/67/CH2/EX2.17.b/example217b.sce b/67/CH2/EX2.17.b/example217b.sce new file mode 100755 index 000000000..71a43610f --- /dev/null +++ b/67/CH2/EX2.17.b/example217b.sce @@ -0,0 +1,5 @@ +//Example 2.17b
+clc;
+disp(' y[n]=x[n-1]+a*x[n-2] ');
+disp('THE GIVEN SYSTEM IS CAUSAL');
+disp('Since the value of output doesnot depends on future input');
\ No newline at end of file diff --git a/67/CH2/EX2.17.c/example217c.sce b/67/CH2/EX2.17.c/example217c.sce new file mode 100755 index 000000000..ef8b994c6 --- /dev/null +++ b/67/CH2/EX2.17.c/example217c.sce @@ -0,0 +1,5 @@ +//Example 2.17c
+clc;
+disp(' y[n]=x[-n] ');
+disp('THE GIVEN SYSTEM IS NON-CAUSAL');
+disp('Since the value of output depends on future input');
\ No newline at end of file diff --git a/67/CH2/EX2.19.a/example219a.sce b/67/CH2/EX2.19.a/example219a.sce new file mode 100755 index 000000000..5471fe7f3 --- /dev/null +++ b/67/CH2/EX2.19.a/example219a.sce @@ -0,0 +1,32 @@ +//Example 2.19a
+clc;
+x1=[1,1,1,1]
+x2=[2,2,2,2]
+a=1
+b=1
+a1=0.5
+b1=0.5
+for n=1:length(x1)
+ x3(n)=a*x1(n)+b*x2(n)
+end
+for n=1:length(x1)
+ y1(n)=a1*n*x1(n)+b1
+ y2(n)=a1*n*x2(n)+b1
+ y3(n)=a1*n*x3(n)+b1
+end
+for n=1:length(y1)
+ z(n)=a*y1(n)+b*y2(n)
+end
+count=0
+for n=1:length(y1)
+ if(y3(n)==z(n))
+ count=count+1;
+ end
+end
+if(count==length(y3))
+disp('It satisfy the superposition principle');
+disp('THE GIVEN SYSTEM IS LINEAR ');
+else
+ disp('It does not satisfy superposition principle ');
+ disp('THE GIVEN SYSTEM IS NON LINEAR');
+end
\ No newline at end of file diff --git a/67/CH2/EX2.19.b/example219b.sce b/67/CH2/EX2.19.b/example219b.sce new file mode 100755 index 000000000..f13e4d4e1 --- /dev/null +++ b/67/CH2/EX2.19.b/example219b.sce @@ -0,0 +1,30 @@ +//Example 2.19b
+clc;
+x1=[1,1,1,1]
+x2=[2,2,2,2]
+a=1
+b=1
+for n=1:length(x1)
+ x3(n)=a*x1(n)+b*x2(n)
+end
+for n=1:length(x1)
+ y1(n)=exp(x1(n))
+ y2(n)=exp(x2(n))
+ y3(n)=exp(x3(n))
+end
+for n=1:length(y1)
+ z(n)=a*y1(n)+b*y2(n)
+end
+count=0
+for n=1:length(y1)
+ if(y3(n)==z(n))
+ count=count+1;
+ end
+end
+if(count==length(y3))
+disp('It satisfy the superposition principle');
+disp('THE GIVEN SYSTEM IS LINEAR ');
+else
+ disp('It does not satisfy superposition principle ');
+ disp('THE GIVEN SYSTEM IS NON LINEAR');
+end
\ No newline at end of file diff --git a/67/CH2/EX2.2/example22.sce b/67/CH2/EX2.2/example22.sce new file mode 100755 index 000000000..7c27cc5b5 --- /dev/null +++ b/67/CH2/EX2.2/example22.sce @@ -0,0 +1,24 @@ +//Example 2.2
+clc;
+t=-8:1/100:8;
+for i=1:length(t)
+ if t(i)<0 then
+ x(i)=0;
+ h(i)=0;
+ else
+ x(i)=exp(-3.*t(i));
+ h(i)=1;
+ end
+end
+t1=t+1;
+y=convol(x,h);
+figure
+plot2d(t1,h);
+title('Impulse responce');
+figure
+plot2d(t,x);
+title('Input signal');
+figure
+t2=-16:1/100:16
+plot2d(t2,y);
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.21.a/example221a.sce b/67/CH2/EX2.21.a/example221a.sce new file mode 100755 index 000000000..48d1b3db4 --- /dev/null +++ b/67/CH2/EX2.21.a/example221a.sce @@ -0,0 +1,30 @@ +//Example 2.21
+clc;
+x1=[1,1,1,1]
+x2=[2,2,2,2]
+a=1
+b=1
+for t=1:length(x1)
+ x3(t)=a*x1(t)+b*x2(t)
+end
+for t=1:length(x1)
+ y1(t)=5*sin(x1(t))
+ y2(t)=5*sin(x2(t))
+ y3(t)=5*sin(x3(t))
+end
+for t=1:length(y1)
+ z(t)=a*y1(t)+b*y2(t)
+end
+count=0
+for n=1:length(y1)
+ if(y3(t)==z(t))
+ count=count+1;
+ end
+end
+if(count==length(y3))
+disp('It satisfy the superposition principle');
+disp('THE GIVEN SYSTEM IS LINEAR ');
+else
+ disp('It does not satisfy superposition principle ');
+ disp('THE GIVEN SYSTEM IS NON LINEAR');
+end
\ No newline at end of file diff --git a/67/CH2/EX2.21.b/example221b.sce b/67/CH2/EX2.21.b/example221b.sce new file mode 100755 index 000000000..e0660a3b5 --- /dev/null +++ b/67/CH2/EX2.21.b/example221b.sce @@ -0,0 +1,30 @@ +//Example 2.21b
+clc;
+x1=[1,1,1,1]
+x2=[2,2,2,2]
+a=1
+b=1
+for t=1:length(x1)
+ x3(t)=a*x1(t)+b*x2(t)
+end
+for t=1:length(x1)
+ y1(t)=7*x1(t)+5
+ y2(t)=7*x2(t)+5
+ y3(t)=7*x3(t)+5
+end
+for t=1:length(y1)
+ z(t)=a*y1(t)+b*y2(t)
+end
+count=0
+for n=1:length(y1)
+ if(y3(t)==z(t))
+ count=count+1;
+ end
+end
+if(count==length(y3))
+disp('It satisfy the superposition principle');
+disp('THE GIVEN SYSTEM IS LINEAR ');
+else
+ disp('It does not satisfy superposition principle ');
+ disp('THE GIVEN SYSTEM IS NON LINEAR');
+end
\ No newline at end of file diff --git a/67/CH2/EX2.25/example225.sce b/67/CH2/EX2.25/example225.sce new file mode 100755 index 000000000..e4215c392 --- /dev/null +++ b/67/CH2/EX2.25/example225.sce @@ -0,0 +1,30 @@ +//Example 2.25
+clc;
+x1=[1,1,1,1]
+x2=[2,2,2,2]
+a=1
+b=1
+for n=1:length(x1)
+ x3(n)=a*x1(n)+b*x2(n)
+end
+for n=1:length(x1)
+ y1(n)=x1(n)^2
+ y2(n)=x2(n)^2
+ y3(n)=x3(n)^2
+end
+for n=1:length(y1)
+ z(n)=a*y1(n)+b*y2(n)
+end
+count=0
+for n=1:length(y1)
+ if(y3(n)==z(n))
+ count=count+1;
+ end
+end
+if(count==length(y3))
+disp('It satisfy the superposition principle');
+disp('THE GIVEN SYSTEM IS LINEAR ');
+else
+ disp('It does not satisfy superposition principle ');
+ disp('THE GIVEN SYSTEM IS NON LINEAR');
+end
\ No newline at end of file diff --git a/67/CH2/EX2.3/example23.sce b/67/CH2/EX2.3/example23.sce new file mode 100755 index 000000000..b6bc33c30 --- /dev/null +++ b/67/CH2/EX2.3/example23.sce @@ -0,0 +1,25 @@ +//Example 2.3
+clc;
+R=100;
+L=100;
+t=-8:1/100:8;
+for i=1:length(t)
+ if t(i)<0 then
+ x(i)=0;
+ h(i)=0;
+ else
+ h(i)=(R/L)*exp(-(R/L).*t(i));
+ x(i)=1;
+ end
+end
+y=convol(x,h);
+figure
+plot2d(t,h);
+title('Impulse responce');
+figure
+plot2d(t,x);
+title('Input signal');
+figure
+t2=-16:1/100:16
+plot2d(t2,y);
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.4/example24.sce b/67/CH2/EX2.4/example24.sce new file mode 100755 index 000000000..375b871e3 --- /dev/null +++ b/67/CH2/EX2.4/example24.sce @@ -0,0 +1,18 @@ +//Example 2.4
+clc;
+t=-8:1/100:8;
+for i=1:length(t)
+ x(i)=3*cos(2.*t(i));
+ h(i)=exp(-abs(t(i)));
+end
+y=convol(x,h);
+figure
+plot2d(t,h);
+title('Impulse responce');
+figure
+plot2d(t,x);
+title('Input signal');
+figure
+t2=-16:1/100:16
+plot2d(t2,y);
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.5/example25.sce b/67/CH2/EX2.5/example25.sce new file mode 100755 index 000000000..05b0eadc4 --- /dev/null +++ b/67/CH2/EX2.5/example25.sce @@ -0,0 +1,27 @@ +//Example 2.5 +clc; +Max_Limit=10; +h=ones(1,Max_Limit); +N2=0:length(h)-1; +a=0.5;//constant a>0 +for t=1:Max_Limit +x(t)=exp(-a*(t-1)); +end +N1=0:length(x)-1; +y=convol(x,h)-1; +N=0:length(x)+length(h)-2; +figure +a=gca(); +plot2d(N2,h) +xtitle('Impulse Response','t','h(t)'); +a.thickness=2; +figure +a=gca(); +plot2d(N1,x) +xtitle('Input Response','t','x(t)'); +a.thickness=2; +figure +a=gca (); +plot2d(N(1:Max_Limit),y(1:Max_Limit)) +xtitle('Output Response','t','y(t)'); +a.thickness=2;
\ No newline at end of file diff --git a/67/CH2/EX2.59/example259.sce b/67/CH2/EX2.59/example259.sce new file mode 100755 index 000000000..2661f9b75 --- /dev/null +++ b/67/CH2/EX2.59/example259.sce @@ -0,0 +1,32 @@ +//Example 2.59
+clc;
+n=-8:1:8;
+for i=1:length(n)
+ if n(i)<0 then
+ x(i)=0;
+ h(i)=0;
+ else
+ x(i)=1;
+ h(i)=2^n(i);
+ end
+end
+y=convol(x,h);
+figure
+a=gca();
+plot2d3(n,h);
+a.x_location='origin';
+a.y_location='origin';
+title('Impulse responce');
+figure
+a=gca();
+plot2d3(n,x);
+a.x_location='origin';
+a.y_location='origin';
+title('Input signal');
+figure
+a=gca();
+n1=-16:1:16
+plot2d3(n1,y);
+a.x_location='origin';
+a.y_location='origin';
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.6/example26.sce b/67/CH2/EX2.6/example26.sce new file mode 100755 index 000000000..c698b7ffa --- /dev/null +++ b/67/CH2/EX2.6/example26.sce @@ -0,0 +1,24 @@ +//Example 2.6
+clc;
+t=-8:1/100:8;
+for i=1:length(t)
+ if t(i)<0 then
+ x(i)=exp(2.*t(i));
+ h(i)=0;
+ else
+ x(i)=0;
+ h(i)=1;
+ end
+end
+t1=t+3;
+y=convol(x,h);
+figure
+plot2d(t1,h);
+title('Impulse responce');
+figure
+plot2d(t,x);
+title('Input signal');
+figure
+t2=-16:1/100:16
+plot2d(t2,y);
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.7/example27.sce b/67/CH2/EX2.7/example27.sce new file mode 100755 index 000000000..9014344d7 --- /dev/null +++ b/67/CH2/EX2.7/example27.sce @@ -0,0 +1,18 @@ +//Example 2.7
+clc;
+n=-8:1:8;
+for i=1:length(n)
+ x(i)=exp(-n(i)^2);
+ h(i)=3.*n(i)^2;
+end
+y=convol(x,h);
+figure
+plot2d3(n,h);
+title('Impulse responce');
+figure
+plot2d3(n,x);
+title('Input signal');
+figure
+n1=-16:1:16
+plot2d3(n1,y);
+title('Output signal');
\ No newline at end of file diff --git a/67/CH2/EX2.8/example28.sce b/67/CH2/EX2.8/example28.sce new file mode 100755 index 000000000..8e348364a --- /dev/null +++ b/67/CH2/EX2.8/example28.sce @@ -0,0 +1,23 @@ +//Example 2.8
+clc;
+n=-8:1:8;
+for i=1:length(n)
+ if n(i)<0 then
+ x(i)=2^n(i);
+ h(i)=0;
+ else
+ x(i)=0;
+ h(i)=1;
+ end
+end
+y=convol(x,h);
+figure
+plot2d3(n,h);
+title('Impulse responce');
+figure
+plot2d3(n,x);
+title('Input signal');
+figure
+n1=-16:1:16
+plot2d3(n1,y);
+title('Output signal');
\ No newline at end of file |