From d62091da14b5f9a4cc47fb915246b6346f4f9fd2 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Wed, 16 Aug 2017 12:57:55 +0200
Subject: [PATCH] Fix plotting of measurement errors in non-MCMC case

Number of plots was wrongly computed

(cherry picked from commit 4cd259baa61c073a1ee2e8c623191b48c626654c)
---
 matlab/dynare_estimation_1.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m
index a4b416614..3fe420a2b 100644
--- a/matlab/dynare_estimation_1.m
+++ b/matlab/dynare_estimation_1.m
@@ -609,10 +609,10 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
     if nvn
         number_of_plots_to_draw = 0;
         index = [];
-        for i=1:n_varobs
-            if max(abs(measurement_error)) > 0.000000001
+        for obs_iter=1:n_varobs
+            if max(abs(measurement_error(obs_iter,:))) > 0.0000001
                 number_of_plots_to_draw = number_of_plots_to_draw + 1;
-                index = cat(1,index,i);
+                index = cat(1,index,obs_iter);
             end
         end
         if ~options_.nograph
@@ -627,7 +627,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
                 fh = dyn_figure(options_.nodisplay,'Name','Smoothed observation errors');
                 NAMES = [];
                 if options_.TeX, TeXNAMES = []; end
-                nstar0=min(nstar,number_of_plots_to_draw-(nbplt-1)*nstar);
+                nstar0=min(nstar,number_of_plots_to_draw-(plt-1)*nstar);
                 if gend==1
                     marker_string{1,1}='-ro';
                     marker_string{2,1}='-ko';
-- 
GitLab