
clear,clc

% Run and collect dynare outputs

cd 'Model1';
dynare Model1;
irfModel1 = oo_.irfs;
save Model1_results.mat irfModel1;
cd ..

cd 'Model2';
dynare Model2;
irfModel2 = oo_.irfs;
save Model1_results.mat irfModel2;
cd ..



ending_cell={'_e_ae'};


% Try with different colors
    set(0,'DefaultAxesColorOrder',linspecer(4))
           
for ii=1:length(ending_cell)
    HOR=1:options_.irf;
    var={'i', 'c', 'k_b', 'b','delta_d','r_t', 'r_ib', 'r_be', 'ib', 'h_i','h_p','ih'}; % variables to be plotted as called in Dynare
   fig(ii)= figure('Name',['Shock to',sprintf(ending_cell{1,ii})],'NumberTitle','off');
    % plot the model variables 
    for jj=1:length(var)-3
        subplot(3,4,jj)
        eval(['irfModel1.' var{1,jj},ending_cell{1,ii}]);
        eval(['irfModel.' var{1,jj},ending_cell{1,ii}]);     
        hold on
        plot(HOR,[eval(['irfModel1.' var{1,jj},ending_cell{1,ii}])],HOR,[eval(['irfModel.' var{1,jj},ending_cell{1,ii}])],'LineWidth',1.3);      
        xlim([1 options_.irf]);
        hline = refline(0, 0);
        title([var{1,jj}] )
    end
    
    legend('Model1', 'Model2', 'AutoUpdate','off')
   
end



