# Generating a vector of steady state variable over a parameter

Hello community, professors and researchers,
I present you my problem:
In my dynare document I used the following code:

``````eta_parameters = 0.1:0.05:1;
for i=1:length(eta_parameters)
set_param_value('eta',eta_parameters(i));
end;
``````

Y is a variable in my document. I wanted to generate the vector of steady state Y values for the interval of eta (and then export it to xls), but I don’t know how to do it. I would be very grateful for any help.

Where is the problem? You seem to have the loop in place. Usually, you just need to read out

``````oo_.steady_state(strmatch('Y',M_.endo_names,'exact'))
``````

Where is the problem? You seem to have the loop in place. Usually, you just need to read out

``````oo_.steady_state(strmatch('Y',M_.endo_names,'exact'))
``````
1 Like

First, thank you for your answer. In the same way I wanted to simulate the model by assigning several values to the same parameters, then export the mean of Y of each simulation, to a vector, that is v. I tried with the command v=strmatch(mean(Y)), but “v” always remains empty. I don’t know how to do it ?

Here is the written code
eta_parameters = 1.5:0.1:2;
for i=1:length(eta_parameters)
set_param_value(‘eta’,eta_parameters(i));
stoch_simul(nograph) Y;
end;
v=strmatch(mean(Y));

In that case, the result is typically in

``````v= oo_.mean(strmatch('Y',var_list_,'exact'))
``````

Thank you very much @jpfeifer. I found an other algorithm, presented in dynare manual, page 17, as following:
psi_params = 0:0.05:1;
for i=1:length(psi_params)
psi = psi_params(i);
stoch_simul();
X_mat(:,i) = X;
end;
It do the same thing.
Best.