diff --git a/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m b/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m index c4273c357..4664d627d 100644 --- a/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m +++ b/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m @@ -115,6 +115,24 @@ else end end +%% Compute the terminal steady state for all informational periods +oo_.pfwee.terminal_steady_state = NaN(M_.endo_nbr, periods); +orig_exo_steady_state = oo_.exo_steady_state; +for p = 1:periods + if p > 1 && all(oo_.pfwee.terminal_info(:, p) == oo_.pfwee.terminal_info(:, p-1)) + oo_.pfwee.terminal_steady_state(:, p) = oo_.pfwee.terminal_steady_state(:, p-1); + else + if p == 1 + init = oo_.steady_state; + else + init = oo_.pfwee.terminal_steady_state(:, p-1); + end + oo_.exo_steady_state = oo_.pfwee.terminal_info(:, p); + oo_.pfwee.terminal_steady_state(:, p) = evaluate_steady_state(init, M_, options_, oo_, true); + end +end +oo_.exo_steady_state = orig_exo_steady_state; + % Build initial paths for endos and exos (only initial conditions are set, the rest is NaN) if isempty(ys0_) oo_.endo_simul = [repmat(oo_.steady_state, 1, M_.maximum_lag) NaN(M_.endo_nbr, periods+M_.maximum_lead)]; diff --git a/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_solver.m b/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_solver.m index 8deee7efb..fdbdda3ce 100644 --- a/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_solver.m +++ b/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_solver.m @@ -42,8 +42,7 @@ end while info_period <= periods % Compute terminal steady state as anticipated oo_.exo_steady_state = oo_.pfwee.terminal_info(:, info_period); - steady_state_prev = oo_.steady_state; - [oo_.steady_state,~,info] = evaluate_steady_state(steady_state_prev, M_, options_, oo_, true); + oo_.steady_state = oo_.pfwee.terminal_steady_state(:, info_period); if options_.pfwee.constant_simulation_length && increment > 0 endo_simul = [ endo_simul NaN(M_.endo_nbr, increment)]; diff --git a/preprocessor b/preprocessor index 6509bc7d3..32761173e 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 6509bc7d3651d7b82adbf4ca53042dbefe6fe7fb +Subproject commit 32761173e00e7e40932341de36507707c16a9311