From 979101fa55643eb4a713c87f36752cf91e7793a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 12 May 2014 12:14:28 +0200
Subject: [PATCH] sim1: when there are NaNs/Infs, raise a warning rather than
 an error.

Otherwise the homotopy procedure can fail prematurely.

Thanks to Tom Holden for the suggestion.
---
 matlab/sim1.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/sim1.m b/matlab/sim1.m
index e08f57a17..87517461a 100644
--- a/matlab/sim1.m
+++ b/matlab/sim1.m
@@ -171,7 +171,7 @@ if stop
         skipline();
         fprintf('\nSimulation terminated after %d iterations.\n',iter);
         fprintf('Total time of simulation: %16.13f\n',etime(clock,h1));
-        error('Simulation terminated with NaN or Inf in the residuals or endogenous variables. There is most likely something wrong with your model.');
+        fprintf('WARNING: Simulation terminated with NaN or Inf in the residuals or endogenous variables. There is most likely something wrong with your model.\n');
     else
         skipline();
         fprintf('\nSimulation concluded successfully after %d iterations.\n',iter);
-- 
GitLab