summaryrefslogtreecommitdiff
path: root/1592/CH6
diff options
context:
space:
mode:
Diffstat (limited to '1592/CH6')
-rwxr-xr-x1592/CH6/EX6.1/Example_6_1.sce72
-rwxr-xr-x1592/CH6/EX6.2/Example_6_2.sce94
-rwxr-xr-x1592/CH6/EX6.5/Example_6_5.sce73
3 files changed, 128 insertions, 111 deletions
diff --git a/1592/CH6/EX6.1/Example_6_1.sce b/1592/CH6/EX6.1/Example_6_1.sce
index 6dfef7a58..c9e89c3fb 100755
--- a/1592/CH6/EX6.1/Example_6_1.sce
+++ b/1592/CH6/EX6.1/Example_6_1.sce
@@ -1,33 +1,39 @@
-//Scilab Code for Example 6.1 of Signals and systems by
-//P.Ramakrishna Rao
-//Sampling of signal
-clc;
-clear f n X X_delta w;
-fs=200;
-for f=-200:200
- X(f+201)=5*[delta(f-75)+delta(f+75)];
-end
-figure(1);
-f=-200:200;
-plot2d3(f,X,-2);
-title('X(f)');
-xlabel('---> f');
-w=1;
-n=-1;
- for f=-275:275
- X_delta1(f+276)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
- end
-n=n+1;
- for f=-275:275
- X_delta2(f+276)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
-end
-n=n+1;
- for f=-275:275
- X_delta3(f+276)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
-end
-X_delta=X_delta1+X_delta2+X_delta3;
-figure(2);
-f=-275:275;
-plot2d3(f,X_delta,-2);
-title('X_delta(f) at fs=200');
-xlabel('---> f');
+//Scilab Code for Example 6.1 of Signals and systems by
+//P.Ramakrishna Rao
+//Sampling of signal
+clc;
+clear
+function [y]=delta(t)
+ if t==0
+ y=1
+else y=0
+ end
+endfunction
+fs=200;
+for f=-200:200
+ X(f+201)=5*[delta(f-75)+delta(f+75)];
+end
+figure(1);
+f=-200:200;
+plot2d3(f,X,-2);
+title('X(f)');
+xlabel('---> f');
+w=1;
+n=-1;
+ for f=-275:275
+ X_delta1(f+276)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+ end
+n=n+1;
+ for f=-275:275
+ X_delta2(f+276)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+end
+n=n+1;
+ for f=-275:275
+ X_delta3(f+276)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+end
+X_delta=X_delta1+X_delta2+X_delta3;
+figure(2);
+f=-275:275;
+plot2d3(f,X_delta,-2);
+title('X_delta(f) at fs=200');
+xlabel('---> f'); \ No newline at end of file
diff --git a/1592/CH6/EX6.2/Example_6_2.sce b/1592/CH6/EX6.2/Example_6_2.sce
index 2b43c42a8..671d6d061 100755
--- a/1592/CH6/EX6.2/Example_6_2.sce
+++ b/1592/CH6/EX6.2/Example_6_2.sce
@@ -1,44 +1,50 @@
-//Scilab Code for Example 6.2 of Signals and systems by
-//P.Ramakrishna Rao
-//Sampling of signal and aliasing due to low Sampling frequency
-clc;
-clear f n X X_delta X_delta1 X_delta2 X_delta3 w;
-fs=100;
-for f=-200:200
- X(f+201)=5*[delta(f-75)+delta(f+75)];
-end
-figure(1);
-f=-200:200;
-plot2d3(f,X,-2);
-title('X(f)');
-xlabel('---> f');
-w=1;
-n=-2;
- for f=-175:175
- X_delta1(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
- end
-n=n+1;
- for f=-175:175
- X_delta2(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
-end
-n=n+1;
- for f=-175:175
- X_delta3(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
-end
-n=n+1;
- for f=-175:175
- X_delta4(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
-end
-n=n+1;
- for f=-175:175
- X_delta5(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
-end
-X_delta=X_delta1+X_delta2+X_delta3+X_delta4+X_delta5;
-figure(2);
-f=-175:175;
-
-plot2d3(f,X_delta,-2);
-title('X_delta(f) at fs=100');
-xlabel('---> f');
-//The Presence of the 25 HZ component in the spectrum of x_delta(t)
-//Due to effect of Aliasing
+//Scilab Code for Example 6.2 of Signals and systems by
+//P.Ramakrishna Rao
+//Sampling of signal and aliasing due to low Sampling frequency
+clc;
+clear
+function [y]=delta(t)
+ if t==0
+ y=1
+else y=0
+ end
+endfunction
+fs=100;
+for f=-200:200
+ X(f+201)=5*[delta(f-75)+delta(f+75)];
+end
+figure(1);
+f=-200:200;
+plot2d3(f,X,-2);
+title('X(f)');
+xlabel('---> f');
+w=1;
+n=-2;
+ for f=-175:175
+ X_delta1(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+ end
+n=n+1;
+ for f=-175:175
+ X_delta2(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+end
+n=n+1;
+ for f=-175:175
+ X_delta3(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+end
+n=n+1;
+ for f=-175:175
+ X_delta4(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+end
+n=n+1;
+ for f=-175:175
+ X_delta5(f+176)=fs*5*[delta(f-n*fs-75)+delta(f-n*fs+75)];
+end
+X_delta=X_delta1+X_delta2+X_delta3+X_delta4+X_delta5;
+figure(2);
+f=-175:175;
+
+plot2d3(f,X_delta,-2);
+title('X_delta(f) at fs=100');
+xlabel('---> f');
+//The Presence of the 25 HZ component in the spectrum of x_delta(t)
+//Due to effect of Aliasing \ No newline at end of file
diff --git a/1592/CH6/EX6.5/Example_6_5.sce b/1592/CH6/EX6.5/Example_6_5.sce
index d42c30e70..0de268f04 100755
--- a/1592/CH6/EX6.5/Example_6_5.sce
+++ b/1592/CH6/EX6.5/Example_6_5.sce
@@ -1,34 +1,39 @@
-//Scilab Code for Example 6.5 of Signals and systems by
-//P.Ramakrishna Rao//Output of LPF
-clc;
-clear;
-
-for f=-100:100
- X(f+101)=delta(f+100)+delta(f-100)+3*[delta(f+90)+delta(f-90)];
-end
-f=-100:100;
-a=gca();
-a.x_location="origin";
-a.y_location="origin";
-plot2d3(f,X,-2);
-title('Spectrum of x(t)');
-xlabel('--> f');
-fs=150;
-n=-1;f-n*fs
- for f=-275:275
- X_delta1(f+276)=delta(f-n*fs+100)+delta(f-n*fs-100)+3*[delta(f-n*fs+90)+delta(f-n*fs-90)];
- end
-n=n+1;
- for f=-275:275
- X_delta2(f+276)=delta(f-n*fs+100)+delta(f-n*fs-100)+3*[delta(f-n*fs+90)+delta(f-n*fs-90)];
-end
-n=n+1;
- for f=-275:275
- X_delta3(f+276)=delta(f-n*fs+100)+delta(f-n*fs-100)+3*[delta(f-n*fs+90)+delta(f-n*fs-90)];
-end
-X_delta=X_delta1+X_delta2+X_delta3;
-figure(2);
-f=-275:275;
-plot2d3(f,X_delta,-2);
-title('X_delta(f) at fs=150');
-xlabel('---> f');
+//Scilab Code for Example 6.5 of Signals and systems by
+//P.Ramakrishna Rao//Output of LPF
+clc;
+clear;
+function [y]=delta(t)
+ if t==0
+ y=1
+else y=0
+ end
+endfunction
+for f=-100:100
+ X(f+101)=delta(f+100)+delta(f-100)+3*[delta(f+90)+delta(f-90)];
+end
+f=-100:100;
+a=gca();
+a.x_location="origin";
+a.y_location="origin";
+plot2d3(f,X,-2);
+title('Spectrum of x(t)');
+xlabel('--> f');
+fs=150;
+n=-1;f-n*fs
+ for f=-275:275
+ X_delta1(f+276)=delta(f-n*fs+100)+delta(f-n*fs-100)+3*[delta(f-n*fs+90)+delta(f-n*fs-90)];
+ end
+n=n+1;
+ for f=-275:275
+ X_delta2(f+276)=delta(f-n*fs+100)+delta(f-n*fs-100)+3*[delta(f-n*fs+90)+delta(f-n*fs-90)];
+end
+n=n+1;
+ for f=-275:275
+ X_delta3(f+276)=delta(f-n*fs+100)+delta(f-n*fs-100)+3*[delta(f-n*fs+90)+delta(f-n*fs-90)];
+end
+X_delta=X_delta1+X_delta2+X_delta3;
+figure(2);
+f=-275:275;
+plot2d3(f,X_delta,-2);
+title('X_delta(f) at fs=150');
+xlabel('---> f'); \ No newline at end of file