summaryrefslogtreecommitdiff
path: root/1592/CH9/EX9.3
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /1592/CH9/EX9.3
parent7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff)
downloadScilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip
updated the code
Diffstat (limited to '1592/CH9/EX9.3')
-rwxr-xr-x1592/CH9/EX9.3/example_9_3.sce52
1 files changed, 29 insertions, 23 deletions
diff --git a/1592/CH9/EX9.3/example_9_3.sce b/1592/CH9/EX9.3/example_9_3.sce
index 9d6385185..bf4e494b9 100755
--- a/1592/CH9/EX9.3/example_9_3.sce
+++ b/1592/CH9/EX9.3/example_9_3.sce
@@ -1,23 +1,29 @@
-//Scilab Code for Example 9.3 of Signals and systems by
-//P.Ramakrishna Rao
-//Convolution of two signals
-clc;
-clear;
-n=1;
-for t=-5:0.1:5
- x(n)=-2*u(t-0.5)+2*u(t-1.5);
- y(n)=(t+1)*u(t+1)-(t+1)*u(t-2);
- n=n+1;
-end
-z=conv(x,y);
-t=-5:0.1:5;
-plot2d2(t,x,5);
-title('x(t)');
-figure(1);
-t=-5:0.1:5;
-plot2d(t,y,2);
-title('y(t)');
-figure(2);
-t=-10:0.1:10;
-plot2d(t,z,6);
-title('Convolution');
+//Scilab Code for Example 9.3 of Signals and systems by
+//P.Ramakrishna Rao
+//Convolution of two signals
+clc;
+clear;
+function [y]=u(t)
+ if t>=0
+ y=1
+else y=0
+ end
+endfunction
+n=1;
+for t=-5:0.1:5
+ x(n)=-2*u(t-0.5)+2*u(t-1.5);
+ y(n)=(t+1)*u(t+1)-(t+1)*u(t-2);
+ n=n+1;
+end
+z=conv(x,y);
+t=-5:0.1:5;
+plot2d2(t,x,5);
+title('x(t)');
+figure(1);
+t=-5:0.1:5;
+plot2d(t,y,2);
+title('y(t)');
+figure(2);
+t=-10:0.1:10;
+plot2d(t,z,6);
+title('Convolution'); \ No newline at end of file