Looping over variances and saving simulations

I’m not sure if this question is specific enough but I’ll give it a try …

I think I’m pretty much all set with the model setup. Here is what I would like to do:

I would like to run many simulations of the model. Each simulation will have different variance. For instance

stdev_eps = 0.001:0.005: 0.10

Each time, I would like to simulate the model under a 2nd order approximation and again under a 1st order approximation and I would like to save the simulated series. Importantly, I would like to use the same set of random draws (so these will simply be one long realization scaled by the standard deviation.

What is the appropriate way of setting something like this up in Dynare? Is it best to use an outer MATLAB loop or should I write a loop in the mod file?

Any advice would be very helpful.

You should program a Matlab loop using the resol-function

[dr,info]=resol(0,M_,options_,oo_);

for recomputing the decision rules after changing the variance entry in M_.Sigma_e and the simult_-function

y2 = simult_(M_,options_,initial_condition_states,dr,shock_matrix,1);

to simulate the model given a set of shocks. For the simult_-function, see https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod