-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench1.jl
46 lines (35 loc) · 793 Bytes
/
bench1.jl
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Nyquist: RNyquistPulse
using CoefFromFunc: coef_from_func
p = RNyquistPulse(0.5)
sps = 4
si = 16
c = coef_from_func(p, 1./sps, sps*si)
using DSP: FIRFilter, setphase!
function (f::FIRFilter)(x)
return filt(f, x)
end
xfilt = FIRFilter(c, sps//1)
rfilt = FIRFilter(c/sps, 1//sps)
setphase!(rfilt, sps-1)
using Constellation
using PnSeq
p = pnseq(2)
Const = QPSKconstellation()
power(u) = norm(u)^2/length(u)
function test1()
xsyms = p(1000000)
xconst = Const(xsyms)
xmit_out = xfilt(xconst)
delay = si-1
rcv_out = rfilt(xmit_out)[delay+1:end]
# using PyPlot
# plot(real(xconst), "x-")
# plot(real(rcv_out), "x-")
err = xconst[1:length(rcv_out)] - rcv_out
return power(err)
end
function test2(N)
for _ in 1:N
mse = test1()
end
end