summaryrefslogtreecommitdiff
path: root/2294/CH2
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /2294/CH2
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '2294/CH2')
-rwxr-xr-x2294/CH2/EX2.2/EX2_2.sce51
-rwxr-xr-x2294/CH2/EX2.3/EX2_3.sce73
-rwxr-xr-x2294/CH2/EX2.4/EX2_4.sce60
-rwxr-xr-x2294/CH2/EX2.5/EX2_5.sce71
-rwxr-xr-x2294/CH2/EX2.7/EX2_7.sce82
5 files changed, 337 insertions, 0 deletions
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
+
+
+
+