diff options
Diffstat (limited to '2294/CH4')
-rwxr-xr-x | 2294/CH4/EX4.10/EX4_10.sce | 29 | ||||
-rwxr-xr-x | 2294/CH4/EX4.11/EX4_11.sce | 29 | ||||
-rwxr-xr-x | 2294/CH4/EX4.12/EX4_12.sce | 62 | ||||
-rwxr-xr-x | 2294/CH4/EX4.4.2/EX4_4_2.sce | 25 | ||||
-rwxr-xr-x | 2294/CH4/EX4.6/EX4_6.sce | 110 | ||||
-rwxr-xr-x | 2294/CH4/EX4.7/EX4_7.sce | 91 | ||||
-rwxr-xr-x | 2294/CH4/EX4.8/EX4_8.sce | 29 | ||||
-rwxr-xr-x | 2294/CH4/EX4.9/EX4_9.sce | 31 |
8 files changed, 406 insertions, 0 deletions
diff --git a/2294/CH4/EX4.10/EX4_10.sce b/2294/CH4/EX4.10/EX4_10.sce new file mode 100755 index 000000000..21eaf7ff5 --- /dev/null +++ b/2294/CH4/EX4.10/EX4_10.sce @@ -0,0 +1,29 @@ +//Find the covolution Of the following signals.
+//Example 4.10
+clc;
+clear;
+close;
+t=-20:.01:20;
+for i=1:length(t)
+ if t(i)<0 | t(i)>2 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+ if t(i)>=10 then
+ h(i)=1;
+else
+ h(i)=0;
+end
+end
+y=convol(h,x);
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-40:.01:40;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.11/EX4_11.sce b/2294/CH4/EX4.11/EX4_11.sce new file mode 100755 index 000000000..de5b5bbf2 --- /dev/null +++ b/2294/CH4/EX4.11/EX4_11.sce @@ -0,0 +1,29 @@ +//Find the covolution Of the following signals.
+//Example 4.11
+clc;
+clear;
+close;
+t=-5:.01:5;
+for i=1:length(t)
+ if t(i)<0 | t(i)>2 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+ if t(i)<-1 | t(i)>2 then
+ h(i)=0;
+else
+ h(i)=2;
+end
+end
+y=convol(h,x);
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-10:.01:10;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.12/EX4_12.sce b/2294/CH4/EX4.12/EX4_12.sce new file mode 100755 index 000000000..7fb0f5ef8 --- /dev/null +++ b/2294/CH4/EX4.12/EX4_12.sce @@ -0,0 +1,62 @@ +//Find the covolution Of the following signals.
+//Example 4.12 <i>
+clc;
+clear;
+close;
+t=-5:.01:5;
+for i=1:length(t)
+ if t(i)>=0 & t(i)<=2 then
+ x(i)=sin(%pi*t(i));
+else
+ x(i)=0;
+ end
+if t(i)<1 | t(i)>3 then
+ h(i)=0;
+else
+ h(i)=1;
+end
+end
+y=convol(h,x);//convolution of the above two signals is done here.
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-10:.01:10;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
+//Find the covolution Of the following signals.
+//Example 4.12 <ii>
+clc;
+clear;
+close;
+t=-5:.01:5;
+for i=1:length(t)
+ if t(i)<0 then
+ x(i)=0;
+ elseif t(i)<1 then
+ x(i)=1+t(i);
+ elseif t(i)<2 then
+ x(i)=1-t(i);
+else
+ x(i)=0;
+end
+if t(i)<0 | t(i)>2 then
+ h(i)=0;
+else
+ h(i)=1;
+end
+end
+y=convol(h,x);
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-10:.01:10;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.4.2/EX4_4_2.sce b/2294/CH4/EX4.4.2/EX4_4_2.sce new file mode 100755 index 000000000..245736d8a --- /dev/null +++ b/2294/CH4/EX4.4.2/EX4_4_2.sce @@ -0,0 +1,25 @@ +//Example 4.4 <ii>
+//Find the step response of the following impulse response.
+clc;
+t=-1:.01:1;
+for i=1:length(t)
+ if t(i)==0 then
+ del1(i)=1;del2(i)=0;
+ elseif t(i)==1 then
+ del1(i)=0;del2(i)=1;
+ else
+ del1(i)=0;del2(i)=0;
+end
+h(i)=del1(i)-del2(i);
+if t(i)<0 then
+ u(i)=0;
+else
+ u(i)=1;
+end
+end
+s=convol(h,u);
+t1=-10:.05:10;
+f=scf(0);
+plot(t1,s,'red');
+xtitle('s[t]');
+xs2jpg(0, 'EX4_4_2-plot-a.jpg');
diff --git a/2294/CH4/EX4.6/EX4_6.sce b/2294/CH4/EX4.6/EX4_6.sce new file mode 100755 index 000000000..a8f932ae3 --- /dev/null +++ b/2294/CH4/EX4.6/EX4_6.sce @@ -0,0 +1,110 @@ +//Find the covolution Of the following signals.
+//Example 4.6<i>
+clc;
+clear;
+close;
+a=.5;
+b=.6;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=exp(-a.*t(i));
+ x2(i)=exp(-b.*t(i));
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_1-plot-a.jpg');
+//Find the covolution Of the following signals.
+//Example 4.6<ii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=1;
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_2-plot-a.jpg');
+//Find the covolution Of the following signals.
+//Example 4.6<iii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=t(i);
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_3-plot-a.jpg');
+//Find the covolution Of the following signals.
+//Example 4.6<iv>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)<0 then
+ x1(i)=0;x2(i)=0;
+ else
+ x1(i)=sin(t(i));
+ x2(i)=1;
+ end
+end
+y=convol(x1,x2);
+f=scf(0);
+subplot(3,1,1);
+plot(x1,t,'red');
+xtitle('x1[t]');
+subplot(3,1,2);
+plot(x2,t,'blue');
+xtitle('x2[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'EX4_6_4-plot-a.jpg');
diff --git a/2294/CH4/EX4.7/EX4_7.sce b/2294/CH4/EX4.7/EX4_7.sce new file mode 100755 index 000000000..2e356f0c3 --- /dev/null +++ b/2294/CH4/EX4.7/EX4_7.sce @@ -0,0 +1,91 @@ +//Find the covolution Of the following signals.
+//Example 4.7<i>
+clc;
+clear;
+close;
+t=-4:.01:4;
+//Define signal h(t)=u(t+2)
+for i=1:length(t)
+ if t(i)<-2 then
+ h(i)=0;
+ else
+ h(i)=1;
+ end
+ //Define signal x(t)=exp^(-2*t)*u(t)
+ if t(i)<0 then
+ x(i)=0;
+else
+ x(i)=exp(-2.*t(i));
+end
+end
+y=convol(h,x);//convolution is done
+f=scf(0);
+subplot(3,1,1);
+plot(h,t,'red');
+xtitle('h[t]');
+subplot(3,1,2);
+plot(x,t,'blue');
+xtitle('x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('y[n]');
+xs2jpg(0, 'problem52-plot.jpg');
+//Find the covolution Of the following signals.
+//Example 4.7<iii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+//Define signal h(t)=u(t-2)
+for i=1:length(t)
+ if t(i)<-1 then
+ h(i)=0;
+ else
+ h(i)=1;
+ end
+ //Define signal x(t)=u(t+1)
+ if t(i)<2 then
+ x(i)=0;
+else
+ x(i)=1;
+end
+end
+y=convol(h,x);//The convolution is done here.
+subplot(3,1,1);
+plot(h,t,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(x,t,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
+//Find the covolution Of the following signals.
+//Example 4.7<ii>
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ x(i)=exp(-abs(t(i)));
+ if t(i)<-1 then
+ h(i)=0;
+ else
+ h(i)=exp(-2.*(t(i)+1)) ;
+ end
+ end
+y=convol(h,x);//Here convolution of the above two signals is done
+subplot(3,1,1);
+plot(h,t,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(x,t,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
+
+
diff --git a/2294/CH4/EX4.8/EX4_8.sce b/2294/CH4/EX4.8/EX4_8.sce new file mode 100755 index 000000000..ebacd9f56 --- /dev/null +++ b/2294/CH4/EX4.8/EX4_8.sce @@ -0,0 +1,29 @@ +//Find the covolution Of the following signals.
+//Example 4.8
+clc;
+clear;
+close;
+t=-4:.01:4;
+for i=1:length(t)
+ if t(i)>=0 & t(i)<=2 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+ if t(i)>=0 & t(i)<=3 then
+ h(i)=1;
+else
+ h(i)=0;
+end
+end
+y=convol(h,x);//Convolution of the above two signals is done.
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-8:.01:8;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
diff --git a/2294/CH4/EX4.9/EX4_9.sce b/2294/CH4/EX4.9/EX4_9.sce new file mode 100755 index 000000000..96a57d8ac --- /dev/null +++ b/2294/CH4/EX4.9/EX4_9.sce @@ -0,0 +1,31 @@ +//Find the covolution Of the following signals.
+//Example 4.9
+clc;
+clear;
+close;
+t=-10:.01:10;
+//input signal:x(t)=u(t-3)-u(t-5)
+for i=1:length(t)
+ if t(i)<3 | t(i)>5 then
+ x(i)=0;
+ else
+ x(i)=1;
+ end
+ //h(t)=exp(-3*t)*u(t)
+ if t(i)>=0 then
+ h(i)=exp(-3.*t(i));
+else
+ h(i)=0;
+end
+end
+y=convol(h,x);//cconvolution of the above two signals
+subplot(3,1,1);
+plot(t,h,'red');
+xtitle('input response 2','t','h[t]');
+subplot(3,1,2);
+plot(t,x,'blue');
+xtitle('input response 2','t','x[t]');
+subplot(3,1,3);
+t1=-20:.01:20;
+plot(t1,y,'green');
+xtitle('output response','t','y[t1]');
|