diff options
Diffstat (limited to '3812/CH2')
-rw-r--r-- | 3812/CH2/EX2.1/2_1.sce | 19 | ||||
-rw-r--r-- | 3812/CH2/EX2.13/2_13.sce | 30 | ||||
-rw-r--r-- | 3812/CH2/EX2.15/2_15.sce | 19 | ||||
-rw-r--r-- | 3812/CH2/EX2.16/2_16.sce | 23 | ||||
-rw-r--r-- | 3812/CH2/EX2.17/2_17.sce | 27 | ||||
-rw-r--r-- | 3812/CH2/EX2.18/2_18.sce | 32 | ||||
-rw-r--r-- | 3812/CH2/EX2.19.a/2_19_a.sce | 25 | ||||
-rw-r--r-- | 3812/CH2/EX2.19.b/2_19_b.sce | 25 | ||||
-rw-r--r-- | 3812/CH2/EX2.19.c/2_19_c.sce | 25 | ||||
-rw-r--r-- | 3812/CH2/EX2.2/2_2.sce | 19 | ||||
-rw-r--r-- | 3812/CH2/EX2.20/2_20.sce | 24 | ||||
-rw-r--r-- | 3812/CH2/EX2.3/2_3.sce | 24 |
12 files changed, 292 insertions, 0 deletions
diff --git a/3812/CH2/EX2.1/2_1.sce b/3812/CH2/EX2.1/2_1.sce new file mode 100644 index 000000000..afbe02690 --- /dev/null +++ b/3812/CH2/EX2.1/2_1.sce @@ -0,0 +1,19 @@ +//Example 2_1
+//Find the convolution of two continous time signal
+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');
diff --git a/3812/CH2/EX2.13/2_13.sce b/3812/CH2/EX2.13/2_13.sce new file mode 100644 index 000000000..a196b56be --- /dev/null +++ b/3812/CH2/EX2.13/2_13.sce @@ -0,0 +1,30 @@ +//Example 2_13
+//Convolution Integral of input x(t)=u(t+0.5)-u(t-0.5) h(t)=exp(%i*w*t)
+clc;
+clear;
+Max_Limit=0.1;
+x=[0,0,0,ones(1,Max_Limit+0.5)-ones(1,Max_Limit-0.5)];
+w=2;
+t=-9:0;
+h=exp(%i*w*t);
+N2=0:length(x)-1;
+N1=-length(h)+1:0;
+t1=-6:3;
+y1=(1/%i*w)*(exp(%i*w*(t1+0.5)));
+y2=(1/%i*w)*(ones(1,Max_Limit));
+y=[y1 y2]
+N=-length(x)+1:length(h)-1;
+figure
+a=gca();
+a.y_location="origin";
+plot2d(t,h)
+xtitle('Input Response','t','h(t)');
+a.thickness=2;
+figure
+a=gca();
+a.y_location="origin";
+a.x_location="origin";
+a.data_bounds=[-10,0;13,1];
+plot2d(-Max_Limit+4:Max_Limit+3,y)
+xtitle('Output Response','t','y(t)');
+a.thickness=2;
diff --git a/3812/CH2/EX2.15/2_15.sce b/3812/CH2/EX2.15/2_15.sce new file mode 100644 index 000000000..bc7142b4e --- /dev/null +++ b/3812/CH2/EX2.15/2_15.sce @@ -0,0 +1,19 @@ +//Example 2_15
+//Find the convolution of two sequences
+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');
diff --git a/3812/CH2/EX2.16/2_16.sce b/3812/CH2/EX2.16/2_16.sce new file mode 100644 index 000000000..90d541a79 --- /dev/null +++ b/3812/CH2/EX2.16/2_16.sce @@ -0,0 +1,23 @@ +//Example 2_15
+//Find the convolution of two sequences
+clc;
+n=-8:1/1000:8;
+for i=1:length(n)
+x(i)=exp(-n(i)^2);
+if n(i)<0 then
+h(i)=exp(n(i));
+else
+h(i)=exp(-n(i));
+end
+end
+y=convol(x,h);
+figure
+plot2d3(n,h);
+title('Impulse responce');
+figure
+plot2d3(n,x);
+title('Input signal');
+figure
+n1=-16:1/1000:16
+plot2d3(n1,y);
+title('Output signal');
diff --git a/3812/CH2/EX2.17/2_17.sce b/3812/CH2/EX2.17/2_17.sce new file mode 100644 index 000000000..4d1910fe4 --- /dev/null +++ b/3812/CH2/EX2.17/2_17.sce @@ -0,0 +1,27 @@ +//Example 2_17
+//find convolution of two sequences
+clc;
+n=-8:1/1000:8;
+for i=1:length(n)
+if n(i)<-5 then
+x(i)=0;
+else
+x(i)=(1/2)^n(i);
+end
+if n(i)<3 then
+h(i)=0;
+else
+h(i)=(1/3)^n(i);
+end
+end
+y=convol(x,h);
+figure
+plot2d3(n,h);
+title('Impulse responce');
+figure
+plot2d3(n,x);
+title('Input signal');
+figure
+n1=-16:1/1000:16
+plot2d3(n1,y);
+title('Output signal');
diff --git a/3812/CH2/EX2.18/2_18.sce b/3812/CH2/EX2.18/2_18.sce new file mode 100644 index 000000000..ae5fec426 --- /dev/null +++ b/3812/CH2/EX2.18/2_18.sce @@ -0,0 +1,32 @@ +//clear//
+//Example 2.8:Convolution Integral of input x(t)=(e^2t).u(-t) and
+//h(t)=u(t-3)
+clear;
+close;
+clc;
+Max_Limit=0.1;
+x=[0,0,0,ones(1,Max_Limit+0.5)-ones(1,Max_Limit-0.5)];
+w=2;
+t = -9:0;
+h= exp(%i*w*t);
+N2 = 0:length(x)-1;
+N1 = -length(h)+1:0;
+t1 = -6:3;
+y1 =(1/%i*w)*(exp(%i*w*(t+0.5)));
+y2 =(1/%i*w)*(ones(1,Max_Limit));
+y = [y1 y2]
+N = -length(x)+1:length(h)-1;
+figure
+a=gca();
+a.y_location = "origin";
+plot2d(t,h)
+xtitle('Input Response','t','h(t)');
+a.thickness = 2;
+figure
+a=gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-10,0;13,1];
+plot2d(-Max_Limit+4:Max_Limit+3,y)
+xtitle('Output Response','t','y(t)');
+a.thickness = 2;
diff --git a/3812/CH2/EX2.19.a/2_19_a.sce b/3812/CH2/EX2.19.a/2_19_a.sce new file mode 100644 index 000000000..486a6bba9 --- /dev/null +++ b/3812/CH2/EX2.19.a/2_19_a.sce @@ -0,0 +1,25 @@ +//Example 2_19 <a>
+//compute the Convolution of x[n] and Unit Impulse response h[n]
+clear;
+close;
+clc;
+Max_Limit=10;
+for n=1:Max_Limit
+Alpha=0.5;
+h=ones(1,Max_Limit);
+N1=0:Max_Limit-1;
+x(n)=1;
+end
+N2=0:Max_Limit-1;
+y=convol(x,h);
+N=0:2*Max_Limit-2;
+figure
+a=gca();
+plot2d3('gnn',N2,x)
+xtitle('Input Response Fig 2.5.(a)','n','x[n]');
+a.thickness=2;
+figure
+a=gca();
+plot2d3('gnn',N(1:Max_Limit),y(1:Max_Limit),5)
+xtitle('Output Response Fig 2.7','n','y[n]');
+a.thickness=2;
diff --git a/3812/CH2/EX2.19.b/2_19_b.sce b/3812/CH2/EX2.19.b/2_19_b.sce new file mode 100644 index 000000000..633529f2c --- /dev/null +++ b/3812/CH2/EX2.19.b/2_19_b.sce @@ -0,0 +1,25 @@ +//Example 2_19 <b>
+//compute the Convolution of x[n] and Unit Impulse response h[n]
+clear;
+close;
+clc;
+Max_Limit=10;
+for n=1:Max_Limit
+Alpha=0.5;
+h=(0.4)^(n)*ones(1,Max_Limit);
+N1=0:Max_Limit-1;
+x(n)=(0.8)^(n-1);
+end
+N2=0:Max_Limit-1;
+y=convol(x,h);
+N=0:2*Max_Limit-2;
+figure
+a=gca();
+plot2d3('gnn',N2,x)
+xtitle('Input Response Fig 2.5.(a)','n','x[n]');
+a.thickness=2;
+figure
+a=gca();
+plot2d3('gnn',N(1:Max_Limit),y(1:Max_Limit),5)
+xtitle('Output Response Fig 2.7','n','y[n]');
+a.thickness=2;
diff --git a/3812/CH2/EX2.19.c/2_19_c.sce b/3812/CH2/EX2.19.c/2_19_c.sce new file mode 100644 index 000000000..73595dbf1 --- /dev/null +++ b/3812/CH2/EX2.19.c/2_19_c.sce @@ -0,0 +1,25 @@ +//Example 2_19 <c>
+//compute the Convolution of x[n] and Unit Impulse response h[n]
+clear;
+close;
+clc;
+Max_Limit=10;
+for n=1:Max_Limit
+Alpha=0.5;
+h=Alpha^(n)*ones(1,Max_Limit);
+N1=0:Max_Limit-1;
+x(n)=(Alpha^(n-1))*1;
+end
+N2=0:Max_Limit-1;
+y=convol(x,h);
+N=0:2*Max_Limit-2;
+figure
+a=gca();
+plot2d3('gnn',N2,x)
+xtitle('Input Response Fig 2.5.(a)','n','x[n]');
+a.thickness=2;
+figure
+a=gca();
+plot2d3('gnn',N(1:Max_Limit),y(1:Max_Limit),5)
+xtitle('Output Response Fig 2.7','n','y[n]');
+a.thickness=2;
diff --git a/3812/CH2/EX2.2/2_2.sce b/3812/CH2/EX2.2/2_2.sce new file mode 100644 index 000000000..bdf19a1d4 --- /dev/null +++ b/3812/CH2/EX2.2/2_2.sce @@ -0,0 +1,19 @@ +//Example 2_2
+//Find the convolution of two continuous time signal
+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');
diff --git a/3812/CH2/EX2.20/2_20.sce b/3812/CH2/EX2.20/2_20.sce new file mode 100644 index 000000000..56b71374a --- /dev/null +++ b/3812/CH2/EX2.20/2_20.sce @@ -0,0 +1,24 @@ +//Example 2_20
+//determine step response of the LTI system
+clc;
+n=-8:1/1000:8;
+for i=1:length(n)
+if n(i)>=0 then
+x(i)=1;
+h(i)=n(i);
+else
+x(i)=0
+h(i)=0;
+end
+end
+y=convol(x,h);
+figure
+plot2d3(n,h);
+title('Impulse responce');
+figure
+plot2d3(n,x);
+title('Input signal');
+figure
+n1=-16:1/1000:16
+plot2d3(n1,y);
+title('Output signal');
diff --git a/3812/CH2/EX2.3/2_3.sce b/3812/CH2/EX2.3/2_3.sce new file mode 100644 index 000000000..ffe4f88c5 --- /dev/null +++ b/3812/CH2/EX2.3/2_3.sce @@ -0,0 +1,24 @@ +//Example 2_3
+//Find the convolution of two continuous time signal
+clc;
+t=-8:1/100:8;
+for i=1:length (t)
+x(i)=exp(-abs(t(i)));
+if t(i)>=1 then
+h(i)=exp(-2*t(i));
+else
+h(i)=0;
+end
+end
+t1=t;
+y= convol (x,h)
+figure
+plot2d(t1,h);
+title('Impul seresponce');
+figure
+plot2d(t,x);
+title('Input signal');
+figure
+t2=-16:1/100:16
+plot2d(t2,y);
+title('Output signal');
|