diff --git a/matlab/graph_decomp.m b/matlab/graph_decomp.m
index 60a0acb5d..20eb7c108 100644
--- a/matlab/graph_decomp.m
+++ b/matlab/graph_decomp.m
@@ -51,6 +51,16 @@ if ~isempty(opts_decomp.type)
fig_mode = [fig_mode '_'];
end
+if isfield(opts_decomp,'init2shocks') && opts_decomp.realtime==0
+ init2shocks_decomp = 1 ;
+else
+ init2shocks_decomp = 0;
+end
+if init2shocks_decomp
+ fig_mode1 = [fig_mode1 '_init2shocks_decomp'];
+ fig_mode = [fig_mode 'init2shocks_decomp_'];
+end
+
if isfield(opts_decomp,'init_cond_decomp')
init_cond_decomp = opts_decomp.init_cond_decomp ;
else
diff --git a/matlab/graph_decomp_detail.m b/matlab/graph_decomp_detail.m
index b19a226b8..2a3aa216e 100644
--- a/matlab/graph_decomp_detail.m
+++ b/matlab/graph_decomp_detail.m
@@ -24,7 +24,7 @@ function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,Dyna
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
-%xf
+%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
@@ -55,6 +55,16 @@ if ~isempty(opts_decomp.type)
fig_mode = [fig_mode '_'];
end
+if isfield(opts_decomp,'init2shocks') && opts_decomp.realtime==0
+ init2shocks_decomp = 1 ;
+else
+ init2shocks_decomp = 0;
+end
+if init2shocks_decomp
+ fig_mode1 = [fig_mode1 '_init2shocks_decomp'];
+ fig_mode = [fig_mode 'init2shocks_decomp_'];
+end
+
if isfield(opts_decomp,'init_cond_decomp')
init_cond_decomp = opts_decomp.init_cond_decomp ;
else
diff --git a/matlab/plot_shock_decomposition.m b/matlab/plot_shock_decomposition.m
index 11ca3b005..68c142bd3 100644
--- a/matlab/plot_shock_decomposition.m
+++ b/matlab/plot_shock_decomposition.m
@@ -50,7 +50,7 @@ if size(varlist,1) == 0
end
end
-if isfield(options_.plot_shock_decomp,'init2shocks') % private trap for uimenu calls
+if isfield(options_.plot_shock_decomp,'init2shocks') && options_.plot_shock_decomp.realtime==0 % private trap for uimenu calls
init2shocks=options_.plot_shock_decomp.init2shocks;
else
init2shocks=[];
@@ -59,7 +59,7 @@ if ~isempty(init2shocks)
init2shocks=M_.init2shocks.(init2shocks);
end
-
+orig_endo_names = M_.endo_names;
epilogue_decomp=false;
if exist_varlist && any(ismember(varlist,M_.epilogue_names))
epilogue_decomp=true;
@@ -252,15 +252,15 @@ if ~isempty(init2shocks) && ~expand
n=size(init2shocks,1);
M_.exo_names_init=M_.exo_names;
for i=1:n
- j=strmatch(init2shocks{i}{1},M_.endo_names,'exact');
+ j=strmatch(init2shocks{i}{1},orig_endo_names,'exact');
if ~isempty(init2shocks{i}{2})
jj=strmatch(init2shocks{i}{2},M_.exo_names,'exact');
- M_.exo_names_init{jj}=[M_.exo_names_init{jj} ' + ' M_.endo_names{j}];
- z(:,jj,:)= z(:,jj,:) + oo_.initval_decomposition (:,j,:);
+ M_.exo_names_init{jj}=[M_.exo_names_init{jj} ' + ' orig_endo_names{j}];
+ z(:,jj,:)= z(:,jj,:) + oo_.initval_decomposition (:,j,1:size(z,3));
else
- z(:,end,:)= z(:,end,:) - oo_.initval_decomposition (:,j,:);
+ z(:,end,:)= z(:,end,:) - oo_.initval_decomposition (:,j,1:size(z,3));
end
- z(:,end-1,:)= z(:,end-1,:) - oo_.initval_decomposition (:,j,:);
+ z(:,end-1,:)= z(:,end-1,:) - oo_.initval_decomposition (:,j,1:size(z,3));
end
end
@@ -271,6 +271,9 @@ if ~epilogue_decomp
else
steady_state = oo_.steady_state;
end
+ if isfield(oo_.shock_decomposition_info,'i_var') && (M_.endo_nbr