summaryrefslogtreecommitdiff
path: root/1592/CH9/EX9.11/example_9_11.sce
blob: 51fb4d67689100248dc1ede7c7d513a3306dd883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Scilab Code for Example 9.11 of Signals and systems by
//P.Ramakrishna Rao
//Power Spectral Density 
clear;
clc;
function [y]=delta(t)
    if t==0
    y=1
else y=0
    end
endfunction
fo=2;
n=1;
RC=1/(2*%pi*10^3);
w=4*%pi*10^3
H=1/(1+%i*w*RC);
disp(H,'H(f)');
X=(abs(H))^2;
for f=-5:5
    Pxx(n)=25*[delta(f-fo)+delta(f+fo)];
    Pyy(n)=X*Pxx(n);
    n=n+1;
end
disp(Pxx,'Pxx=');
disp(Pyy,'Pyy=');
f=-5:5;
plot2d3(f,Pyy,-2);
title('Power Spectral Density');
ylabel('Pyy(f)');
xlabel('f in Hz');