summaryrefslogtreecommitdiff
path: root/2279/CH4
diff options
context:
space:
mode:
Diffstat (limited to '2279/CH4')
-rw-r--r--2279/CH4/EX4.1/Ex4_1.sce20
-rw-r--r--2279/CH4/EX4.10/Ex4_10.sce21
-rw-r--r--2279/CH4/EX4.11/Ex4_11.sce21
-rw-r--r--2279/CH4/EX4.13/Ex4_13.sce21
-rw-r--r--2279/CH4/EX4.14/Ex4_14.sce21
-rw-r--r--2279/CH4/EX4.15/Ex4_15.sce22
-rw-r--r--2279/CH4/EX4.16/Ex4_16.sce22
-rw-r--r--2279/CH4/EX4.17/Ex4_17.sce22
-rw-r--r--2279/CH4/EX4.18/Ex4_18.sce23
-rw-r--r--2279/CH4/EX4.19/Ex4_19.sce25
-rw-r--r--2279/CH4/EX4.2/Ex4_2.sce12
-rw-r--r--2279/CH4/EX4.20/Ex4_20.sce24
-rw-r--r--2279/CH4/EX4.21/Ex4_21.sce23
-rw-r--r--2279/CH4/EX4.23/Ex4_23.sce42
-rw-r--r--2279/CH4/EX4.24/Ex4_24.sce24
-rw-r--r--2279/CH4/EX4.26/Ex4_26.sce52
-rw-r--r--2279/CH4/EX4.27/Ex4_27.sce21
-rw-r--r--2279/CH4/EX4.30/Ex4_30.sce33
-rw-r--r--2279/CH4/EX4.5/Ex4_5.sce20
-rw-r--r--2279/CH4/EX4.6/Ex4_6.sce20
20 files changed, 489 insertions, 0 deletions
diff --git a/2279/CH4/EX4.1/Ex4_1.sce b/2279/CH4/EX4.1/Ex4_1.sce
new file mode 100644
index 000000000..16df5cecc
--- /dev/null
+++ b/2279/CH4/EX4.1/Ex4_1.sce
@@ -0,0 +1,20 @@
+//Example 4.1
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=[0 1 2];
+n1=0:4;
+x=[0.5 0.5 0.5];
+h=[3 2 1];
+y=convol(h,x)
+disp("Convolution of x[n] and h[n] is...")
+disp(y)
+subplot(3,1,1)
+xtitle("","....................n","x[n]");
+plot2d3('gnn',n,x,5);
+subplot(3,1,2)
+xtitle("","....................n","h[n]");
+plot2d3('gnn',n,h,5);
+subplot(3,1,3)
+xtitle("",".............................n","y[n]");
+plot2d3('gnn',n1,y,5);
diff --git a/2279/CH4/EX4.10/Ex4_10.sce b/2279/CH4/EX4.10/Ex4_10.sce
new file mode 100644
index 000000000..09fe34655
--- /dev/null
+++ b/2279/CH4/EX4.10/Ex4_10.sce
@@ -0,0 +1,21 @@
+//Example 4.10
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=0:2;
+n1=0:4;
+x=[0.5 0.5 0.5];
+h=[3 2 1];
+A=[x 0 0;0 x 0; 0 0 x];
+y=A'*h'
+disp("Convolution of x[n] and h[n] is...")
+disp(y)
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n1,y,'.');
diff --git a/2279/CH4/EX4.11/Ex4_11.sce b/2279/CH4/EX4.11/Ex4_11.sce
new file mode 100644
index 000000000..9563bb9b3
--- /dev/null
+++ b/2279/CH4/EX4.11/Ex4_11.sce
@@ -0,0 +1,21 @@
+//Example 4.11
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=-1:1;
+n1=-2:2;
+x=[0.5 0.5 0.5];
+h=[3 2 1];
+A=[x 0 0;0 x 0; 0 0 x];
+y=A'*h'
+disp("Convolution of x[n] and h[n] is...")
+disp(y)
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot2d3('gnn',n,x,5);
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot2d3('gnn',n,h,5);
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot2d3('gnn',n1,y,5);
diff --git a/2279/CH4/EX4.13/Ex4_13.sce b/2279/CH4/EX4.13/Ex4_13.sce
new file mode 100644
index 000000000..58b5521a4
--- /dev/null
+++ b/2279/CH4/EX4.13/Ex4_13.sce
@@ -0,0 +1,21 @@
+//Example 4.13
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=0:100;
+n1=0:200;
+for i=1:length(n)
+ x(i)=n(i);
+ h(i)=1;
+end
+y=convol(x,h);
+disp(y)
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n1,y,'.');
diff --git a/2279/CH4/EX4.14/Ex4_14.sce b/2279/CH4/EX4.14/Ex4_14.sce
new file mode 100644
index 000000000..06942d2f9
--- /dev/null
+++ b/2279/CH4/EX4.14/Ex4_14.sce
@@ -0,0 +1,21 @@
+//Example 4.14
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=0:100;
+n1=0:200;
+a=0.7//assume the constant a=0.7
+for i=1:length(n)
+ x(i)=a^n(i);
+ h(i)=1;
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n1,y,'.');
diff --git a/2279/CH4/EX4.15/Ex4_15.sce b/2279/CH4/EX4.15/Ex4_15.sce
new file mode 100644
index 000000000..19973d1c5
--- /dev/null
+++ b/2279/CH4/EX4.15/Ex4_15.sce
@@ -0,0 +1,22 @@
+//Example 4.15
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n1=-100:1:0;
+n2=0:100;
+n3=-100:100;
+a=0.5//assume the constant a=0.5
+for i=1:length(n1)
+ x(i)=a^-n1(i);
+ h(i)=a^n1(i);
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.16/Ex4_16.sce b/2279/CH4/EX4.16/Ex4_16.sce
new file mode 100644
index 000000000..516f52d8f
--- /dev/null
+++ b/2279/CH4/EX4.16/Ex4_16.sce
@@ -0,0 +1,22 @@
+//Example 4.16
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n1=-100:-2;
+n2=2:100;
+n3=-98:98;
+a=1/2//assume the constant a=1/2
+for i=1:length(n1)
+ x(i)=a^-n1(i);
+ h(i)=1;
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.17/Ex4_17.sce b/2279/CH4/EX4.17/Ex4_17.sce
new file mode 100644
index 000000000..f72c2aa29
--- /dev/null
+++ b/2279/CH4/EX4.17/Ex4_17.sce
@@ -0,0 +1,22 @@
+//Example 4.17
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n1=2:12;
+n2=4:14;
+n3=6:26;
+a=1/3//assume the constant a=1/3
+for i=1:length(n1)
+ x(i)=a^-n1(i);
+ h(i)=1;
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.18/Ex4_18.sce b/2279/CH4/EX4.18/Ex4_18.sce
new file mode 100644
index 000000000..b8e2032bc
--- /dev/null
+++ b/2279/CH4/EX4.18/Ex4_18.sce
@@ -0,0 +1,23 @@
+//Example 4.18
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n1=-100:0;
+n2=0:100;
+n3=-100:100;
+b=0.8//assume the constant b=0.4
+a=0.8//assume the constant a=0.8
+for i=1:length(n1)
+ x(i)=a^n1(i);
+ h(i)=b^n1(i);
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.19/Ex4_19.sce b/2279/CH4/EX4.19/Ex4_19.sce
new file mode 100644
index 000000000..97630f089
--- /dev/null
+++ b/2279/CH4/EX4.19/Ex4_19.sce
@@ -0,0 +1,25 @@
+//Example 4.19
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n1=0:9;
+n2=0:100;
+n3=0:109;
+b=0.8//assume the constant b=0.4
+a=0.8//assume the constant a=0.8
+for i=1:length(n1)
+ x(i)=a^n1(i);
+end
+for j=1:length(n2)
+ h(j)=b^n2(j);
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.2/Ex4_2.sce b/2279/CH4/EX4.2/Ex4_2.sce
new file mode 100644
index 000000000..573c7465b
--- /dev/null
+++ b/2279/CH4/EX4.2/Ex4_2.sce
@@ -0,0 +1,12 @@
+//Example 4.2
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=-1:1;
+n1=-2:2;
+x=[0.5 0.5 0.5];
+h=[3 2 1];
+y=coeff(poly(h,'z','c')*poly(x,'z','c'))
+disp("Convolution of x[n] and h[n] is...")
+disp(y)
+
diff --git a/2279/CH4/EX4.20/Ex4_20.sce b/2279/CH4/EX4.20/Ex4_20.sce
new file mode 100644
index 000000000..a2845b430
--- /dev/null
+++ b/2279/CH4/EX4.20/Ex4_20.sce
@@ -0,0 +1,24 @@
+//Example 4.20
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n1=0:5;
+n2=0:7;
+n3=0:12;
+a=0.8//assume the constant a=0.8
+for i=1:length(n1)
+ x(i)=1;
+end
+for j=1:length(n2)
+ h(j)=a^n2(j);
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.21/Ex4_21.sce b/2279/CH4/EX4.21/Ex4_21.sce
new file mode 100644
index 000000000..871235eee
--- /dev/null
+++ b/2279/CH4/EX4.21/Ex4_21.sce
@@ -0,0 +1,23 @@
+//Example 4.21
+//Convolution of x(t) and h(t)
+clc
+clear
+t1=0:0.01:5;
+t2=0:0.01:2;
+t3=0:0.01:7;
+for i=1:length(t1)
+ x(i)=1;
+end
+for j=1:length(t2)
+ h(j)=1;
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(t)","....................t","x[t]");
+plot(t1,x);
+subplot(3,1,2)
+xtitle("system response h(t)","....................t","h[t]");
+plot(t2,h);
+subplot(3,1,3)
+xtitle("output signal y(t)",".............................t","y[t]");
+plot(t3,y);
diff --git a/2279/CH4/EX4.23/Ex4_23.sce b/2279/CH4/EX4.23/Ex4_23.sce
new file mode 100644
index 000000000..7e1724b52
--- /dev/null
+++ b/2279/CH4/EX4.23/Ex4_23.sce
@@ -0,0 +1,42 @@
+//Example 4.23
+//Convolution of x(t) and h(t)
+clc
+clear
+t1=0:0.01:20;
+t2=0:0.01:20;
+t3=0:0.01:40;
+a1=0.5;//constants a and b are equal
+b1=0.5;
+a2=0.8;// constants a and b are unequal
+b2=0.3;
+for i=1:length(t1)
+ x1(i)=exp(-a1*t1(i));
+ x2(i)=exp(-a2*t1(i));
+end
+for j=1:length(t2)
+ h1(j)=exp(-b1*t2(j));
+ h2(j)=exp(-b2*t2(j));
+end
+//case 1: a & b are equal
+y1=convol(x1,h1);
+subplot(3,1,1)
+xtitle("input signal x(t)","....................t","x[t]");
+plot(t1,x1);
+subplot(3,1,2)
+xtitle("system response h(t)","....................t","h[t]");
+plot(t2,h1);
+subplot(3,1,3)
+xtitle("output signal y(t)",".............................t","y[t]");
+plot(t3,y1);
+//case 2: a& b are unequal
+figure(1)
+y2=convol(x2,h2);
+subplot(3,1,1)
+xtitle("input signal x(t)","....................t","x[t]");
+plot(t1,x2);
+subplot(3,1,2)
+xtitle("system response h(t)","....................t","h[t]");
+plot(t2,h2);
+subplot(3,1,3)
+xtitle("output signal y(t)",".............................t","y[t]");
+plot(t3,y2);
diff --git a/2279/CH4/EX4.24/Ex4_24.sce b/2279/CH4/EX4.24/Ex4_24.sce
new file mode 100644
index 000000000..26e4ba5b7
--- /dev/null
+++ b/2279/CH4/EX4.24/Ex4_24.sce
@@ -0,0 +1,24 @@
+//Example 4.24
+//Convolution of x(t) and h(t)
+clc
+clear
+t1=-3:0.01:10;
+t2=1:0.01:10;
+t3=-2:0.01:20;
+a=0.5//assume a=0.5
+for i=1:length(t1)
+ x(i)=exp(-a*t1(i));
+end
+for j=1:length(t2)
+ h(j)=exp(-a*t2(j));
+end
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(t)","....................t","x[t]");
+plot(t1,x);
+subplot(3,1,2)
+xtitle("system response h(t)","....................t","h[t]");
+plot(t2,h);
+subplot(3,1,3)
+xtitle("output signal y(t)",".............................t","y[t]");
+plot(t3,y);
diff --git a/2279/CH4/EX4.26/Ex4_26.sce b/2279/CH4/EX4.26/Ex4_26.sce
new file mode 100644
index 000000000..0b55d5c1b
--- /dev/null
+++ b/2279/CH4/EX4.26/Ex4_26.sce
@@ -0,0 +1,52 @@
+//Interconnectiuion of LTI systems
+n=-10:10;
+for i=1:length(n)
+ if(n(i)==0)
+ h1(i)=2;
+ else
+ h1(i)=1;
+ end
+end
+for i=1:length(n)
+ if(n(i)==2)
+ h2(i)=1;
+ else
+ h2(i)=0;
+ end
+end
+for i=1:length(n)
+ if(n(i)>=1)
+ h3(i)=1;
+ else
+ h3(i)=0;
+end
+end
+for i=1:length(n)
+ if(n(i)>= -1)
+ h4(i)=1;
+ else
+ h4(i)=0;
+ end
+end
+for i=1:length(n)
+ h5(i)=n(i);
+ h6(i)=1;
+end
+h23=h2.*h3;
+h234=h4+h23;
+h1234=h1.*h234;
+h56=h5.*h6;
+h=h56+h1234;
+x=[1 -0.5];
+n1=[0 1];
+y=convol(x,h);
+n2=-10:11;
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n2,y,'.');
diff --git a/2279/CH4/EX4.27/Ex4_27.sce b/2279/CH4/EX4.27/Ex4_27.sce
new file mode 100644
index 000000000..a90807b05
--- /dev/null
+++ b/2279/CH4/EX4.27/Ex4_27.sce
@@ -0,0 +1,21 @@
+//Example 4.27
+//Interconnectiuion of LTI systems
+n2=0:18;
+h1=[1 5 10 11 8 4 1];
+h2=[1 1 zeros(1,5)];
+h3=[1 1 zeros(1,5)];
+a=convol(h1,h2);
+h=convol(a,h3);
+x=[1 -1];
+n1=[0 1];
+n3=0:19;
+y=convol(x,h);
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n1,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n2,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n3,y,'.');
diff --git a/2279/CH4/EX4.30/Ex4_30.sce b/2279/CH4/EX4.30/Ex4_30.sce
new file mode 100644
index 000000000..83912f6d8
--- /dev/null
+++ b/2279/CH4/EX4.30/Ex4_30.sce
@@ -0,0 +1,33 @@
+//Example 4.30
+//Cascade connection of systems
+clc
+clear
+n=0:10;
+h11=[1 -0.5];
+for i=1:length(n)
+ h2(i)=0.5^n(i);
+ if (n(i)==0) then
+ h1(i)=1;
+ elseif n(i)==1 then
+ h1(i)=-0.5
+ else
+ h1(i)=0;
+ end
+end
+h=convol(h11,h2);
+n2=0:11;
+//assume x[n]=[1 1 1]
+n1=0:2;
+x=[1 1 1];
+n3=0:13;
+y=convol(x,h);
+subplot(3,1,1);
+plot(n1,x,'.');
+xtitle("Input Signal x[n]","n","x[n]")
+subplot(3,1,2);
+plot(n2,h,'.');
+xtitle("Impulse Response h[n]","n","h[n]")
+subplot(3,1,3);
+plot(n3,y,'.');
+xtitle("Output Signal y[n]","n","y[n]")
+disp("the given system is an invertible system");
diff --git a/2279/CH4/EX4.5/Ex4_5.sce b/2279/CH4/EX4.5/Ex4_5.sce
new file mode 100644
index 000000000..489ebefab
--- /dev/null
+++ b/2279/CH4/EX4.5/Ex4_5.sce
@@ -0,0 +1,20 @@
+//Example 4.5
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=0:2;
+n1=0:4;
+x=[0.5 0.5 0.5];
+h=[3 2 1];
+y=coeff(poly(h,'z','c')*poly(x,'z','c'))
+disp("Convolution of x[n] and h[n] is...")
+disp(y)
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n1,y,'.');
diff --git a/2279/CH4/EX4.6/Ex4_6.sce b/2279/CH4/EX4.6/Ex4_6.sce
new file mode 100644
index 000000000..19f8fc8b6
--- /dev/null
+++ b/2279/CH4/EX4.6/Ex4_6.sce
@@ -0,0 +1,20 @@
+//Example 4.6
+//Convolution sum of x[n] and h[n]
+clc
+clear
+n=-1:1;
+n1=-2:2;
+x=[0.5 0.5 0.5];
+h=[3 2 1];
+y=coeff(poly(h,'z','c')*poly(x,'z','c'))
+disp("Convolution of x[n] and h[n] is...")
+disp(y)
+subplot(3,1,1)
+xtitle("input signal x(n)","....................n","x[n]");
+plot(n,x,'.');
+subplot(3,1,2)
+xtitle("system response h(n)","....................n","h[n]");
+plot(n,h,'.');
+subplot(3,1,3)
+xtitle("output signal y(n)",".............................n","y[n]");
+plot(n1,y,'.');