extra option about choosing the time periods for which to plot decompositions

time-shift
Marco Ratto 2017-02-13 10:15:32 +01:00 committed by Stéphane Adjemian (Charybdis)
parent 1920fb0bfe
commit 7a6b4f3464
2 changed files with 27 additions and 2 deletions

View File

@ -727,6 +727,8 @@ options_.shock_decomp.detail_plot=0;
options_.shock_decomp.fig_names='';
options_.shock_decomp.init_state = 0;
options_.shock_decomp.interactive = 0;
options_.shock_decomp.plot_end_date=[];
options_.shock_decomp.plot_init_date=[];
options_.shock_decomp.screen_shocks=0;
options_.shock_decomp.steadystate=0;
options_.shock_decomp.type = '';

View File

@ -291,6 +291,15 @@ switch type
initial_date = initial_date0;
z=z(:,:,t0:4:end);
end
if ~isempty(options_.shock_decomp.plot_init_date)
options_.shock_decomp.plot_init_date = dates([int2str(options_.shock_decomp.plot_init_date.time(1)) 'Y']);
end
if ~isempty(options_.shock_decomp.plot_end_date)
options_.shock_decomp.plot_end_date = dates([int2str(options_.shock_decomp.plot_end_date.time(1)) 'Y']);
end
otherwise
error('plot_shock_decomposition:: Wrong type')
@ -306,11 +315,25 @@ if nargout
return
end
% here we crop data if needed
my_initial_date = initial_date;
a = 1;
b = size(z,3);
if ~isempty(options_.shock_decomp.plot_init_date)
my_initial_date = max(initial_date,options_.shock_decomp.plot_init_date);
a = find((initial_date:initial_date+b-1)==options_.shock_decomp.plot_init_date);
end
if ~isempty(options_.shock_decomp.plot_end_date)
b = find((initial_date:initial_date+b-1)==options_.shock_decomp.plot_end_date);
end
z = z(:,:,a:b);
% end crop data
options_.shock_decomp.fig_names=fig_names;
if detail_plot,
graph_decomp_detail(z,shock_names,M_.endo_names,i_var,initial_date,M_,options_)
graph_decomp_detail(z,shock_names,M_.endo_names,i_var,my_initial_date,M_,options_)
else
graph_decomp(z,shock_names,M_.endo_names,i_var,initial_date,M_,options_);
graph_decomp(z,shock_names,M_.endo_names,i_var,my_initial_date,M_,options_);
end
if write_xls