Plot responses to two DIFFERENT shocks in the same plot

Hello,

I want to plot response to two different shocks (e_v and e_g) in the same plot, not two different subplots. I could not manage to modify the code below to achieve what I want. Could you please help? Thank you.

dynare cap
load('cap.mat', 'oo_')
irf1=oo_.irfs;
save irf1
load irf1

ending_cell={'_e_v','_e_g'};

for ii=1:length(ending_cell)
    HOR=1:options_.irf;
    var={'yy','nx','cc','ii','nn', 'kk','u', 'a','r'};
    figure
    for jj=1:length(var)
        subplot(2,4,jj,'align')
        eval(['irf1.' var{1,jj},ending_cell{1,ii}]);
        hold on
        plot(HOR,[eval(['irf1.' var{1,jj},ending_cell{1,ii}])],'-k','LineWidth',1);
        title([var{1,jj}] )
    end
end

Please provide a full code I can execute.

cap.mod (3.4 KB)
grafik.m (483 Bytes)
I attached them.

u_steadystate_helper.m (656 Bytes)

Use the following. There were various issues.
cap.mod (3.4 KB)
u_steadystate_helper.m (656 Bytes)
grafik.m (377 Bytes)

Thank you very much Professor!

Sir, IRF’s are plotted such that the shock is given at t=1. I know that IRF’s are stored that way. But I want to plot the IRF’s as if the shock is given at t=0. I mean, I just want to change the values in the x-axis in the IRF’s. Is there a quick way that I can manipulate the code you sent above?

Instead of

        plot(1:options_.irf,oo_.irfs.([var{1,jj},ending_cell{1,ii}]),color_string{ii},'LineWidth',1);

use

        plot(0:options_.irf-1,oo_.irfs.([var{1,jj},ending_cell{1,ii}]),color_string{ii},'LineWidth',1);