summaryrefslogtreecommitdiff
path: root/1592/CH1/EX1.7/Example1_7.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /1592/CH1/EX1.7/Example1_7.sce
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/CH1/EX1.7/Example1_7.sce')
-rwxr-xr-x1592/CH1/EX1.7/Example1_7.sce74
1 files changed, 40 insertions, 34 deletions
diff --git a/1592/CH1/EX1.7/Example1_7.sce b/1592/CH1/EX1.7/Example1_7.sce
index e6f31fdfa..955fcf848 100755
--- a/1592/CH1/EX1.7/Example1_7.sce
+++ b/1592/CH1/EX1.7/Example1_7.sce
@@ -1,34 +1,40 @@
-//Scilab Code for Example 1.7 of Signals and systems by
-//P.Ramakrishna Rao
-clear;
-clc;
-n=1;
-for t=-10:0.1:10;
- //Function for Even signal
- y1(n)=0.5*(exp(-t)*u(t)+exp(t)*u(-t));
- n=n+1;
-end
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-t=-10:0.1:10;
-//Plot of Even Signal
-plot(t,y1);
-title('y1(t)');
-xlabel('Time in seconds');
-n=1;
-for t=-1:0.01:1;
- //Function for Odd signal
- y2(n)=0.5*(exp(-t)*u(t)-exp(t)*u(-t));
- n=n+1;
-end
-figure(1);
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-t=-1:0.01:1;
-//Plot of Odd Signal
-plot(t,y2)
-disp('plotted the signal both in even and odd forms');
-title('y2(t)');
-xlabel('Time in seconds');
+//Scilab Code for Example 1.7 of Signals and systems by
+//P.Ramakrishna Rao
+clear;
+clc;
+function [y]=u(t)
+ if t>=0
+ y=1
+else y=0
+ end
+endfunction
+n=1;
+for t=-10:0.1:10;
+ //Function for Even signal
+ y1(n)=0.5*(exp(-t)*u(t)+exp(t)*u(-t));
+ n=n+1;
+end
+a=gca();
+a.x_location="origin";
+a.y_location="origin";
+t=-10:0.1:10;
+//Plot of Even Signal
+plot(t,y1);
+title('y1(t)');
+xlabel('Time in seconds');
+n=1;
+for t=-1:0.01:1;
+ //Function for Odd signal
+ y2(n)=0.5*(exp(-t)*u(t)-exp(t)*u(-t));
+ n=n+1;
+end
+figure(1);
+a=gca();
+a.x_location="origin";
+a.y_location="origin";
+t=-1:0.01:1;
+//Plot of Odd Signal
+plot(t,y2)
+disp('plotted the signal both in even and odd forms');
+title('y2(t)');
+xlabel('Time in seconds'); \ No newline at end of file