Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cont_run(time=10000, n=10000, σ=0.005, λ=10, q=0.1)
- r = zeros(time)
- θ = zeros(n)
- for t in 1:time
- Zt = 0
- ε = randn() * σ
- @inbounds for i in 1:n
- if ε > θ[i]
- Zt += 1
- elseif ε < -θ[i]
- Zt -= 1
- end
- end
- r[t] = Zt / (λ*n)
- @inbounds for i in 1:n
- if rand() < q
- θ[i] = abs(r[t])
- end
- end
- end
- return mean(r)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement