From 0839ff78aecf43d5cf0cab62d219e3b4b58f3409 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 8 Nov 2023 15:49:39 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20sim1=5Flbj.m:=20use=20options=5F?=
 =?UTF-8?q?.dynatol.x=20and=20not=20options=5F.dynatol.f=20for=20terminal?=
 =?UTF-8?q?=20condition?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The maximum error is computed over the change in endogenous (i.e. ΔY).
---
 matlab/perfect-foresight-models/sim1_lbj.m | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/matlab/perfect-foresight-models/sim1_lbj.m b/matlab/perfect-foresight-models/sim1_lbj.m
index 06d8e9c52a..63138e22b2 100644
--- a/matlab/perfect-foresight-models/sim1_lbj.m
+++ b/matlab/perfect-foresight-models/sim1_lbj.m
@@ -4,8 +4,13 @@ function [endogenousvariables, success, err, iter] = sim1_lbj(endogenousvariable
 %
 % INPUTS
 %   ...
+%
 % OUTPUTS
-%   ...
+%   endogenousvariables [matrix]        All endogenous variables of the model
+%   success             [logical]       Whether a solution was found
+%   err                 [double]        ∞-norm of Δendogenousvariables
+%   iter                [integer]       Number of iterations
+%
 % ALGORITHM
 %   Laffargue, Boucekkine, Juillard (LBJ)
 %   see Juillard (1996) Dynare: A program for the resolution and
@@ -96,7 +101,7 @@ for iter = 1:options_.simul.maxit
     if verbose
         fprintf('Iter: %s,\t err. = %s, \t time = %s\n', num2str(iter), num2str(err), num2str(etime(clock, h2)));
     end
-    if err < options_.dynatol.f
+    if err < options_.dynatol.x
         success = true; % Convergency obtained.
         break
     end
-- 
GitLab