summaryrefslogtreecommitdiff
path: root/1592/CH10
diff options
context:
space:
mode:
Diffstat (limited to '1592/CH10')
-rwxr-xr-x1592/CH10/EX10.11/example_10_11.sce45
-rwxr-xr-x1592/CH10/EX10.5/example_10_5.sce47
-rwxr-xr-x1592/CH10/EX10.8/example_10_8.sce47
3 files changed, 74 insertions, 65 deletions
diff --git a/1592/CH10/EX10.11/example_10_11.sce b/1592/CH10/EX10.11/example_10_11.sce
index e2f72428c..70ca8ea2f 100755
--- a/1592/CH10/EX10.11/example_10_11.sce
+++ b/1592/CH10/EX10.11/example_10_11.sce
@@ -1,23 +1,22 @@
-//Scilab Code for Example 10.11 of Signals and systems by
-//P.Ramakrishna Rao
-//System Identification
-//Cross Correlation
-clear;
-clc;
-clear x n a y h z;
-x=[1,1,1,1,0,0];
-y=[1,3,6,10,12,12,10,6,3,1];
-h(1)=y(1)/x(1);
-for n=2:7
- for k=1:n-1
- z(k)=(h(k)*x(n-k));
- h(n)=(y(n)-sum(z));
- end
-end
-disp(h,'h(n)');
-n=1:7;
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot2d3(n,h,-4);
-title('System Response h(n)');
+//Scilab Code for Example 10.11 of Signals and systems by
+//P.Ramakrishna Rao
+//System Identification
+//Cross Correlation
+clear;
+clc;
+x=[1,1,1,1,0,0];
+y=[1,3,6,10,12,12,10,6,3,1];
+h(1)=y(1)/x(1);
+for n=2:7
+ for k=1:n-1
+ z(k)=(h(k)*x(n-k));
+ h(n)=(y(n)-sum(z));
+ end
+end
+disp(h,'h(n)');
+n=1:7;
+a=gca();
+a.x_location="origin";
+a.y_location="origin";
+plot2d3(n,h,-4);
+title('System Response h(n)'); \ No newline at end of file
diff --git a/1592/CH10/EX10.5/example_10_5.sce b/1592/CH10/EX10.5/example_10_5.sce
index 7c4224bb5..561e70462 100755
--- a/1592/CH10/EX10.5/example_10_5.sce
+++ b/1592/CH10/EX10.5/example_10_5.sce
@@ -1,21 +1,26 @@
-//Scilab Code for Example 10.5 of Signals and systems by
-//P.Ramakrishna Rao
-//Auto Correlation
-clear;
-clc;
-clear x n a;
-k=1;
-a=0.8;
-for n=-30:30;
- x(k)=a^(-n)*u(-n);
- k=k+1;
-end
-length(x)
-//computation of auto correlation sequence;
-r = xcorr(x);
-n=-60:60;
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot2d3(n,r,-4);
-title('rxx_auto-correlation');
+//Scilab Code for Example 10.5 of Signals and systems by
+//P.Ramakrishna Rao
+//Auto Correlation
+clear;
+clc;
+function [y]=u(t)
+ if t>=0
+ y=1
+else y=0
+ end
+endfunction
+k=1;
+a=0.8;
+for n=-30:30;
+ x(k)=a^(-n)*u(-n);
+ k=k+1;
+end
+length(x)
+//computation of auto correlation sequence;
+r = xcorr(x);
+n=-60:60;
+a=gca();
+a.x_location="origin";
+a.y_location="origin";
+plot2d3(n,r,-4);
+title('rxx_auto-correlation'); \ No newline at end of file
diff --git a/1592/CH10/EX10.8/example_10_8.sce b/1592/CH10/EX10.8/example_10_8.sce
index e5f1e553c..bc7464bb9 100755
--- a/1592/CH10/EX10.8/example_10_8.sce
+++ b/1592/CH10/EX10.8/example_10_8.sce
@@ -1,21 +1,26 @@
-//Scilab Code for Example 10.8 of Signals and systems by
-//P.Ramakrishna Rao
-//Auto Correlation
-clear;
-clc;
-clear x n a;
-k=1;
-a=0.8;
-for n=-30:30;
- x(k)=a^(n)*u(n);
- k=k+1;
-end
-length(x)
-//computation of auto correlation sequence;
-r = xcorr(x);
-n=-60:60;
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot2d3(n,r,-4);
-title('rxx_auto-correlation');
+//Scilab Code for Example 10.8 of Signals and systems by
+//P.Ramakrishna Rao
+//Auto Correlation
+clear;
+clc;
+function [y]=u(t)
+ if t>=0
+ y=1
+else y=0
+ end
+endfunction
+k=1;
+a=0.8;
+for n=-30:30;
+ x(k)=a^(n)*u(n);
+ k=k+1;
+end
+length(x)
+//computation of auto correlation sequence;
+r = xcorr(x);
+n=-60:60;
+a=gca();
+a.x_location="origin";
+a.y_location="origin";
+plot2d3(n,r,-4);
+title('rxx_auto-correlation'); \ No newline at end of file