diff options
Diffstat (limited to '1592/CH1')
-rwxr-xr-x | 1592/CH1/EX1.11/Example1_11.sce | 82 | ||||
-rwxr-xr-x | 1592/CH1/EX1.7/Example1_7.sce | 74 |
2 files changed, 84 insertions, 72 deletions
diff --git a/1592/CH1/EX1.11/Example1_11.sce b/1592/CH1/EX1.11/Example1_11.sce index ade4e6a1a..5aefda4cd 100755 --- a/1592/CH1/EX1.11/Example1_11.sce +++ b/1592/CH1/EX1.11/Example1_11.sce @@ -1,38 +1,44 @@ -//Scilab Code for Example 1.11 of Signals and systems by
-//P.Ramakrishna Rao
-//displaying plots for the given signals
-clear;
-clc;
-for t=-3:1:3
-y(t+4)=abs(t+3)*u(t+3)-abs(t+1)*u(t+1)-abs(t-1)*u(t-1)+abs(t-3)*u(t-3);
-end
-t=-3:1:3;
-//for the main given signal
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot(t,y);
-title('Main Signal)');
-dy=0*y;
-for i=1:6
-dy(i)=(y(i+1)-y(i))/1;
-end
-//for the derivative of the given signal
-figure(1);
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot2d2(t,dy);
-title('Derivative of Signal');
-dy2=0*dy;
-dy2(1)=dy(1)-0;
-for i=1:6
-dy2(i+1)=(dy(i+1)-dy(i))/1;
-end
-//for the impulse response representation or second derivative
-figure(2);
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot2d3(t,dy2,-5);
-title('Impulse response representation');
+//Scilab Code for Example 1.11 of Signals and systems by +//P.Ramakrishna Rao +//displaying plots for the given signals +clear; +clc; +function [y]=u(t) + if t>=0 + y=1 +else y=0 + end +endfunction +for t=-3:1:3 +y(t+4)=abs(t+3)*u(t+3)-abs(t+1)*u(t+1)-abs(t-1)*u(t-1)+abs(t-3)*u(t-3); +end +t=-3:1:3; +//for the main given signal +a=gca(); +a.x_location="origin"; +a.y_location="origin"; +plot(t,y); +title('Main Signal)'); +dy=0*y; +for i=1:6 +dy(i)=(y(i+1)-y(i))/1; +end +//for the derivative of the given signal +figure(1); +a=gca(); +a.x_location="origin"; +a.y_location="origin"; +plot2d2(t,dy); +title('Derivative of Signal'); +dy2=0*dy; +dy2(1)=dy(1)-0; +for i=1:6 +dy2(i+1)=(dy(i+1)-dy(i))/1; +end +//for the impulse response representation or second derivative +figure(2); +a=gca(); +a.x_location="origin"; +a.y_location="origin"; +plot2d3(t,dy2,-5); +title('Impulse response representation');
\ No newline at end of file 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 |