transfer_functions.jl 271 Bytes
Newer Older
Fredrik Bagge Carlson's avatar
dev tf  
Fredrik Bagge Carlson committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using DSP
function tfest(y,u)
    Cyu = xcorr(y,u)
    Cuu = xcorr(u,u)
    Syu = welch_pgram(Cyu)
    Suu = welch_pgram(Cuu)
    return H = TF(Syu.power./Suu.power,Syu.freq)

end


N = 200000;
u = randn(N);
y = filt(ones(30),30,u);

H = tfest(y,u);
loglog(H.f,abs(H.P))