sat sim
The snippet can be accessed without any authentication.
Authored by
Jonas Krolzik
Edited
sim.jl 1.23 KiB
function getsim(N::Integer, M::Integer, yaw::Real, pitch::Real, roll::Real, σC::Real, σP::Real, σn::Real, λ::Real = 1.0)
# crosstalk variance
σct = σC / 100
Pmean = 170
# define 5σ value of phase error from PLL
phaseerr = 3
σPphase = deg2rad(phaseerr)/5
cmplx(amplitude::Real, angle::Real) = amplitude * cis(angle)
# Gain/Phase mismatch
Cdiagamp = rand(Normal(1, σC), N-1)
Cdiagphase = rand(Uniform(-π,π), N-1)
Cd = cmplx.(Cdiagamp,Cdiagphase)
# Crosstalk
Cctamp = Symmetric(rand(Normal(0,σct), N, N))
Cctphase = Symmetric(rand(Uniform(-π,π), N, N))
C = cmplx.(Cctamp,Cctphase)
C[diagind(C)] = vcat(Cd, 1)
Cre = real.(C)
Cim = imag.(C)
data = rand(Bool,M)
bipolar(x::Bool) = Int(x)*2-1
databp = bipolar.(data)
Pamp = rand(Normal(Pmean, σP), M) .* databp
Pphase = rand(Normal(0, σPphase), M)
P = cmplx.(Pamp, Pphase)
Pre = real.(P)
Pim = imag.(P)
ϕ = rand(Uniform(-π, π), M)
θ = rand(Uniform( 0, π/2), M)
meas = model(yaw, pitch, roll, Cre, Cim, Pre, Pim, ϕ, θ, R, λ)
# [real(noises), imag(noise)]
noise = rand(Normal(0, σn/2), 2*N*M)
return Cre, Cim, Pre, Pim, meas, noise, ϕ, θ
end
Please register or sign in to comment