From f51a8edf50f0c60f6355ac77a579900153f22993 Mon Sep 17 00:00:00 2001 From: Michel Juillard <michel.juillard@mjui.fr> Date: Thu, 29 Sep 2011 21:22:27 +0200 Subject: [PATCH] fixing bug for computation of expectation auxiliary variables steadystate value when *_steadystate.m is provided without setting auxiliary variables --- .../add_auxiliary_variables_to_steadystate.m | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/matlab/add_auxiliary_variables_to_steadystate.m b/matlab/add_auxiliary_variables_to_steadystate.m index 1ed9c5722..d99e36ebb 100644 --- a/matlab/add_auxiliary_variables_to_steadystate.m +++ b/matlab/add_auxiliary_variables_to_steadystate.m @@ -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 -- GitLab