implement new options flip and diff for plotting decompositions

time-shift
Marco Ratto 2019-12-05 13:20:12 +01:00
parent 2184195826
commit 79bdde79e0
1 changed files with 21 additions and 0 deletions

View File

@ -46,6 +46,16 @@ endo_nbr = M_.endo_nbr;
nshocks = M_.exo_nbr;
fig_name='';
if isfield(options_.plot_shock_decomp,'diff') % private trap for uimenu calls
differentiate_decomp=options_.plot_shock_decomp.diff;
else
differentiate_decomp=0;
end
if isfield(options_.plot_shock_decomp,'flip') % private trap for uimenu calls
flip_decomp=options_.plot_shock_decomp.flip;
else
flip_decomp=0;
end
if isfield(options_.plot_shock_decomp,'expand') % private trap for uimenu calls
expand=options_.plot_shock_decomp.expand;
else
@ -229,6 +239,12 @@ if isempty(options_.plot_shock_decomp.colormap)
options_.plot_shock_decomp.colormap = MAP;
end
if differentiate_decomp
z(:,:,2:end) = z(:,:,2:end)-z(:,:,1:end-1);
z(:,:,1) = nan;
steady_state = steady_state*0;
end
switch type
case '' % default
@ -337,6 +353,11 @@ switch type
error('plot_shock_decomposition:: Wrong type')
end
if flip_decomp
z = -z;
steady_state = - steady_state;
end
if steadystate
options_.plot_shock_decomp.steady_state=steady_state;
end