From 36e7bcdbcd0977f147d3c250b8657b72c38b3e07 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 24 Jul 2015 10:08:43 +0200
Subject: [PATCH] Add headers and more documentation to shock_decomposition.m
 and graph_decomp.m

---
 doc/dynare.texi              |  4 +++-
 matlab/graph_decomp.m        | 14 ++++++++++++--
 matlab/shock_decomposition.m |  3 ++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index d661d35b6e..5c0c1ec229 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -6137,7 +6137,9 @@ which the shock decomposition has been requested. The second dimension stores
 in the first @code{M_.exo_nbr} columns the contribution of the respective shocks.
 Column @code{M_.exo_nbr+1} stores the contribution of the initial conditions,
 while column @code{M_.exo_nbr+2} stores the smoothed value of the respective
-endogenous variable. The third dimension stores the time periods.
+endogenous variable. The third dimension stores the time periods. Both the variables 
+and shocks are stored in the order of declaration, i.e. @code{M_.endo_names} and 
+{M_.exo_names}, respectively.
 
 @end deffn
 
diff --git a/matlab/graph_decomp.m b/matlab/graph_decomp.m
index 5e5bed5857..abf1bc9fe9 100644
--- a/matlab/graph_decomp.m
+++ b/matlab/graph_decomp.m
@@ -1,7 +1,17 @@
 function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel,DynareOptions)
-%function []=graph_decomp(z,varlist,initial_period,freq)
+%function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel,DynareOptions)
+% Plots the results from the shock_decomposition command
+% 
+% Inputs
+%   z               [n_var*(nshock+2)*nperiods]     shock decomposition array, see shock_decomposition.m for details
+%   shock_names     [endo_nbr*string length]        shock names from M_.exo_names
+%   endo_names      [exo_nbr*string length]         variable names from M_.endo_names
+%   i_var           [n_var*1]                       vector indices of requested variables in M_.endo_names and z
+%   initial_date    [dseries object]                first period of decomposition to plot
+%   DynareModel     [structure]                     Dynare model structure
+%   DynareOptions   [structure]                     Dynare options structure
 
-% Copyright (C) 2010-2013 Dynare Team
+% Copyright (C) 2010-2015 Dynare Team
 %
 % This file is part of Dynare.
 %
diff --git a/matlab/shock_decomposition.m b/matlab/shock_decomposition.m
index bdfed236e4..d8d8a07d3c 100644
--- a/matlab/shock_decomposition.m
+++ b/matlab/shock_decomposition.m
@@ -4,7 +4,8 @@ function oo_ = shock_decomposition(M_,oo_,options_,varlist)
 % oo_.shock_decomposition. It is a n_var by nshock+2 by nperiods array. The
 % first nshock columns store the respective shock contributions, column n+1
 % stores the role of the initial conditions, while column n+2 stores the
-% value of the smoothed variables.
+% value of the smoothed variables.  Both the variables and shocks are stored 
+% in the order of declaration, i.e. M_.endo_names and M_.exo_names, respectively.
 %
 % INPUTS
 %    M_:          [structure]  Definition of the model
-- 
GitLab