Dears，

I’m following discussion here and what I’m also doing with grid search is to generate expected welfare for different monetary rules setting.

Here is my example code for loop.

```
aaa=
0.1 0.3
0.1 0.3
0.1 0.3
0.1 0.3];
first_time = 1;
welfare=zeros(1,2);
for i1=1:2
e=aaa(1,i1);
f=aaa(2,i1);
g=aaa(3,i1);
h=aaa(4,i1);
if first_time
save parameterfile1 e f g h;
dynare LcpTax.mod noclearall;
first_time = 0;
else
set_param_value('sigma1',e);
set_param_value('sigma2',f);
set_param_value('sigmas1',g);
set_param_value('sigmas2',h);
nv=101;
eu_v=zeros(1,nv);
eus_v=zeros(1,nv);
eu_w=zeros(1,nv);
for jj=1:nv;
v=(jj-1)/(nv-1);
info=stoch_simul(var_list_);
eu_v(jj)=oo_.mean(26);
cbar=oo_.steady_state(1);
lbar=oo_.steady_state(3);
eu_v(jj)=(((eu_v(jj)*(1-beta)+eta*lbar)*(1-rho))^(1/(1-rho))/cbar-1)*100;
eus_v(jj)=oo_.mean(27);
csbar=oo_.steady_state(13);
lsbar=oo_.steady_state(15);
eus_v(jj)=(((eus_v(jj)*(1-beta)+eta*lsbar)*(1-rho))^(1/(1-rho))/csbar-1)*100;
eu_w(jj)=n*eu_v(jj)+(1-n)*eus_v(jj);
end;
```

My questions is:

based on the discussion, we only need to call dynare once and then change different parameter and redo the simulation. I double check the result in this example code, and find that the estimated welfare are different between calling dynare each time and the method mentioned in the previous code.

I believe that calling dynare for each loop will return the correct result, then anyone could suggest what’s the problem with my code listed above?