Hello,

I was thinking how to implement the following code snippet into a vectorized form, but I couldn't figure out how to do this effectively. The issue I face is the lagged value of y which changes over the loop. Does anybody have an alternative way to run this thing?

<hansl>
scalar T = 100
scalar b1 = -0.2
scalar b2 = 0.5
matrix u = mnormal(T,1)
matrix dx = mnormal(T,1)
matrix dy = zeros(T,1)
matrix y = zeros(T,1)

loop i=2..T -q
    dy[i] = b1*y[(i-1)] + b2*dx[i] + u[i]
   
    y[i] = y[i-1] + dy[i]
endloop
<\hansl>

Thanks in advance.
Artur