From 84eaaaf7597c15927bb088ffb191f74309824105 Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Thu, 1 Dec 2011 22:03:20 +0100
Subject: [PATCH] fixed another bug with missing current value at 2nd order

---
 matlab/dr1.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/dr1.m b/matlab/dr1.m
index 84c6b8ba4..909b78229 100644
--- a/matlab/dr1.m
+++ b/matlab/dr1.m
@@ -466,7 +466,7 @@ A(:,k0) = jacobia_(:,nonzeros(lead_lag_incidence(M_.maximum_endo_lag+1,order_var
 % variables with the highest lead
 k1 = find(kstate(:,2) == M_.maximum_endo_lag+2);
 % Jacobian with respect to the variables with the highest lead
-fyp = jacobia_(:,kstate(k1,3)+M_.endo_nbr);
+fyp = jacobia_(:,kstate(k1,3)+nnz(M_.lead_lag_incidence(M_.maximum_endo_lag+1,:)));
 B(:,nstatic+npred-dr.nboth+1:end) = fyp;
 offset = M_.endo_nbr;
 gx1 = dr.ghx;
-- 
GitLab