Commit f51a8edf authored by MichelJuillard's avatar MichelJuillard
Browse files

fixing bug for computation of expectation auxiliary variables

steadystate value when *_steadystate.m is provided without setting
auxiliary variables
parent 1825d266
......@@ -20,35 +20,19 @@ function ys1 = add_auxiliary_variables_to_steadystate(ys,aux_vars,fname, ...
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
n = length(aux_vars);
ys1 = [ys;zeros(n,1)];
k = size(ys,1)+1;
aux_lead_nbr = 0;
for i=1:n
if aux_vars(i).type == 1
% lagged variables
ys1(k) = ys(aux_vars(i).orig_index);
elseif aux_vars(i).type == 0
% lead variables
aux_lead_nbr = aux_lead_nbr + 1;
end
k = k+1;
end
if aux_lead_nbr
for i=1:aux_lead_nbr+1;
if byte_code
[info, res] = bytecode('static','evaluate',ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
else
res = feval([fname '_static'],ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
end;
for j=1:n
if aux_vars(j).type == 0
el = aux_vars(j).endo_index;
ys1(el) = ys1(el)-res(el);
end
end
for i=1:n+1;
if byte_code
[info, res] = bytecode('static','evaluate',ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
else
res = feval([fname '_static'],ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
end;
for j=1:n
el = aux_vars(j).endo_index;
ys1(el) = ys1(el)-res(el);
end
end
\ No newline at end of file
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment