diff options
Diffstat (limited to '1592/CH6/EX6.5/Example_6_5.sce')
-rwxr-xr-x | 1592/CH6/EX6.5/Example_6_5.sce | 73 |
1 files changed, 39 insertions, 34 deletions
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 |