summaryrefslogtreecommitdiff
path: root/1592/CH7/EX7.23/Example_7_23.sce
diff options
context:
space:
mode:
Diffstat (limited to '1592/CH7/EX7.23/Example_7_23.sce')
-rwxr-xr-x1592/CH7/EX7.23/Example_7_23.sce77
1 files changed, 41 insertions, 36 deletions
diff --git a/1592/CH7/EX7.23/Example_7_23.sce b/1592/CH7/EX7.23/Example_7_23.sce
index b24378108..44dd336f5 100755
--- a/1592/CH7/EX7.23/Example_7_23.sce
+++ b/1592/CH7/EX7.23/Example_7_23.sce
@@ -1,36 +1,41 @@
-//Scilab Code for Example 7.23 of Signals and systems by
-//P.Ramakrishna Rao
-//Convolution of two signals
-clc;
-clear;
-clear x y n;
-for n=0:10;
- x(n+1)=(0.5)^n*u(n-2);
-end
-c = gca();
-c.y_location = "origin";
-c.x_location = "origin";
-n=0:10;
-plot2d3(n,x,-4);
-title('x(n)')
-xlabel('n')
-for n=0:10;
- y(n+1)=u(n);
-end
-figure(1);
-n=0:10;
-c = gca();
-c.y_location = "origin";
-c.x_location = "origin";
-plot2d3(n,y,-4);
-title('y(k)')
-xlabel('k')
-z=conv(x,y);
-figure(2);
-n=0:20;
-c = gca();
-c.y_location = "origin";
-c.x_location = "origin";
-plot2d3(n,z,-4);
-title('Convoluted signal z(t)')
-xlabel('t')
+//Scilab Code for Example 7.23 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
+for n=0:10;
+ x(n+1)=(0.5)^n*u(n-2);
+end
+c = gca();
+c.y_location = "origin";
+c.x_location = "origin";
+n=0:10;
+plot2d3(n,x,-4);
+title('x(n)')
+xlabel('n')
+for n=0:10;
+ y(n+1)=u(n);
+end
+figure(1);
+n=0:10;
+c = gca();
+c.y_location = "origin";
+c.x_location = "origin";
+plot2d3(n,y,-4);
+title('y(k)')
+xlabel('k')
+z=conv(x,y);
+figure(2);
+n=0:20;
+c = gca();
+c.y_location = "origin";
+c.x_location = "origin";
+plot2d3(n,z,-4);
+title('Convoluted signal z(t)')
+xlabel('t') \ No newline at end of file