Simulation using Policy functions

Hi everyone,

I ask for the following help:

I attempted to understand how the second-order approximation worked in Dynare. I specified a value for periods, provided the initial value close enough to the steady state and typed “steady”, so I generated a stochastic simulation starting from the steady state. Then I found the results of policy functions. Following the reference manual, I set down the following lines in Matlab:


Here zeros(5,1) means that I have 5 endogeneous state variables and that the difference of them compared to the steady state is zero since I simulate from the steady state. But the result of the simulation in the first period differs from the simulation conducted by Dynare, which was correct. I wonder where I made a mistake.

I am not entirely sure what you are doing, but
1.) oo_.exo_simul is supposed to be for perfect foresight simulations.
2.) There is a difference between the declaration order of oo_.dr.ys and the declaration order of the gh-matrices. See simult_.m for the way Dynare conducts simulations.