From 57fd56c90a41bba62f413e0ced53ddc1a15f39f8 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Tue, 1 Aug 2017 11:04:46 +0200
Subject: [PATCH] sim1_linear.m: Fix evaluation of dynamic model at
 deterministic steady state

Did not correctly account for exogenous variables being potentially present with leads and lags
---
 matlab/perfect-foresight-models/sim1_linear.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/matlab/perfect-foresight-models/sim1_linear.m b/matlab/perfect-foresight-models/sim1_linear.m
index 85dc384058..080a60a5dd 100644
--- a/matlab/perfect-foresight-models/sim1_linear.m
+++ b/matlab/perfect-foresight-models/sim1_linear.m
@@ -111,7 +111,8 @@ dynamicmodel = str2func([M.fname,'_dynamic']);
 z = steadystate_y([ip; ic; in]);
 
 % Evaluate the Jacobian of the dynamic model at the deterministic steady state.
-[d1,jacobian] = dynamicmodel(z, transpose(steadystate_x), params, steadystate_y, 1);
+[d1,jacobian] = dynamicmodel(z, repmat(transpose(steadystate_x),options.periods+M.maximum_lag+M.maximum_lead,1),...
+    params, steadystate_y, M.maximum_lag+1);
 
 % Check that the dynamic model was evaluated at the steady state.
 if max(abs(d1))>1e-12
-- 
GitLab