From e192f739b73e44831c0fe08688dd8556f2c103eb Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Fri, 11 Oct 2013 19:32:52 +0200 Subject: [PATCH] Filter out shocks specified twice for IRF generation --- matlab/getIrfShocksIndx.m | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/matlab/getIrfShocksIndx.m b/matlab/getIrfShocksIndx.m index 715a530bc..737bfcfb1 100644 --- a/matlab/getIrfShocksIndx.m +++ b/matlab/getIrfShocksIndx.m @@ -1,6 +1,14 @@ function irf_shocks_indx=getIrfShocksIndx() - -% Copyright (C) 2011 Dynare Team +% irf_shocks_indx=getIrfShocksIndx() +% returns the unique indices of the exogenous shocks specified for IRF +% generation using the irf_shocks-command +% +% Inputs: +% none +% Outputs: +% irf_shocks_indx: [1 by n_irf_shocks] vector storing the indices +% +% Copyright (C) 2011-13 Dynare Team % % This file is part of Dynare. % @@ -26,4 +34,10 @@ else for i=1:size(options_.irf_shocks,1) irf_shocks_indx(i) = find(strcmp(deblank(options_.irf_shocks(i,:)), cellstr(M_.exo_names))); end + irf_shocks_indx_unique=unique(irf_shocks_indx); + if options_.debug && (length(irf_shocks_indx_unique) ~= length(irf_shocks_indx)) + fprintf('\nSTOCH_SIMUL: Warning: The IRFs for some shocks have been requested twice.\n') + fprintf('STOCH_SIMUL: The redundant entries will be ignored.\n') + end + irf_shocks_indx=irf_shocks_indx_unique; end