From 131a68ea6fb85919a9564d25b21e690024b055a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Scylla=29?= <stephane.adjemian@univ-lemans.fr> Date: Wed, 16 Aug 2017 16:43:43 +0200 Subject: [PATCH] Provide more informations if expected shocks are declared after the terminal period. --- .../perfect_foresight_setup.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/matlab/perfect-foresight-models/perfect_foresight_setup.m b/matlab/perfect-foresight-models/perfect_foresight_setup.m index fc6a4bce75..97e2ee199b 100644 --- a/matlab/perfect-foresight-models/perfect_foresight_setup.m +++ b/matlab/perfect-foresight-models/perfect_foresight_setup.m @@ -52,7 +52,16 @@ if options_.periods == 0 end if ~isempty(M_.det_shocks) && options_.periods<max([M_.det_shocks.periods]) - error('PERFECT_FORESIGHT_SETUP: number of periods for the simulation is specified to be smaller than the period of the last shock') + % Some expected shocks happen after the terminal period. + mess = sprintf('Problem with the declaration of the expected shocks:\n'); + for i=1:length(M_.det_shocks) + if any(M_.det_shocks(i).periods>options_.periods); + mess = sprintf('%s\n At least one expected value for %s has been declared after the terminal period.', mess, deblank(M_.exo_names(M_.det_shocks(i).exo_id,:))); + end + end + disp(mess) + skipline() + error('PERFECT_FORESIGHT_SETUP: Please check the declaration of the shocks or increase the value of the periods option.') end if ~options_.initval_file -- GitLab