From 669aaa105e1d2e124eb8ef05e8b46ef8dab87e10 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
 (cherry picked from commit 1d1c9acccdd2330086338c5cf68c6dabd5638549)

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

diff --git a/matlab/dr1.m b/matlab/dr1.m
index ffb725115..bf8fd981c 100644
--- a/matlab/dr1.m
+++ b/matlab/dr1.m
@@ -529,7 +529,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