From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 62/CH2/EX2.6/ex_2_6.sce | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 62/CH2/EX2.6/ex_2_6.sce (limited to '62/CH2/EX2.6/ex_2_6.sce') diff --git a/62/CH2/EX2.6/ex_2_6.sce b/62/CH2/EX2.6/ex_2_6.sce new file mode 100755 index 000000000..9ff4644cd --- /dev/null +++ b/62/CH2/EX2.6/ex_2_6.sce @@ -0,0 +1,43 @@ +//Example 2.6:Convolution Integral +clear; +close; +clc; +t =-5:1/100:5; +for i=1:length(t) + if t(i)<0 then + h(i)=0; + x(i)=0; + elseif t(i)<=2 + h(i)=1; + x(i)=1; + elseif t(i)<=3 + h(i)=0; + x(i)=1; + else + h(i)=0; + x(i)=0; + end +end +y = convol(x,h)./100; +figure +a=gca(); +a.x_location="origin"; +plot2d(t,h) +xtitle('Impulse Response','t','h(t)'); +a.children.children.thickness = 3; +a.children.children.foreground= 2; +figure +a=gca(); +plot2d(t,x) +xtitle('Input Response','t','x(t)'); +a.children.children.thickness = 3; +a.children.children.foreground= 2; +figure +a=gca(); +t1=-10:1/100:10; +a.y_location="origin"; +a.x_location="origin"; +plot2d(t1,y) +xtitle('Output Response','t','y(t)'); +a.children.children.thickness = 3; +a.children.children.foreground= 2; \ No newline at end of file -- cgit