From 830150717cdb8352dcdb8ea85312d8244307b00e Mon Sep 17 00:00:00 2001
From: michel <michel@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Sat, 7 Jan 2006 20:52:43 +0000
Subject: [PATCH] v3: -dr1.m: corrected bug for models with exogenous
 deterministic variables     -forecast.m: dealing with case when
 options_.periods < size(ex_det_,1)

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v3@585 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 matlab/dr1.m      | 2 +-
 matlab/forecast.m | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/matlab/dr1.m b/matlab/dr1.m
index fd890ff5e..fefc49c4b 100644
--- a/matlab/dr1.m
+++ b/matlab/dr1.m
@@ -177,7 +177,7 @@ b11 = b(1:nstatic,nstatic+1:end);
 b2 = b(nstatic+1:end,nstatic+1:end);
 nz = nnz(iy_);
 if exo_nbr
-  fu = aa(:,nz+1:end);
+  fu = aa(:,nz+[1:exo_nbr]);
 end
 clear aa;
 
diff --git a/matlab/forecast.m b/matlab/forecast.m
index f07ee6364..60c3e5a67 100644
--- a/matlab/forecast.m
+++ b/matlab/forecast.m
@@ -19,10 +19,12 @@ function forecast(var_list)
   if exo_det_nbr == 0
     [yf,var_yf] = forcst(dr_,y0,options_.periods,var_list);
   else
-    ex = zeros(options_.periods,exo_nbr);
     if options_.periods > size(ex_det_,1)
+      ex = zeros(options_.periods,exo_nbr);
       ex_det_ = [ ex_det_; repmat(exe_det_',options_.periods- ...
 				  size(ex_det_,1),1)];
+    elseif options_.periods < size(ex_det_,1)
+      ex = zeros(size(ex_det_,1),exo_nbr); 
     end
     [yf,int_width] = simultxdet(y0,dr_,ex,ex_det_,options_.order, ...
 				  var_list);
-- 
GitLab