Errors in plotting irfs from 2 model into the same figure

Dear all:
I want to plot the irfs of two model under the same shock in 1 figure and compare them. I use the code in .m matlab file below:

clc
dynare FACP.mod
load(‘FACP_results.mat’, ‘oo_’)
irf1=oo_;
save irf1
load irf1

dynare mpa_k.mod noclearall
load(‘mpa_k_results.mat’, ‘oo_’)
irf2=oo_;
save irf2
load irf2

ending_cell={‘_e_Ne’};

for ii=1:length(ending_cell)
HOR=1:1:40;
var={‘y’,‘c’,‘inv’,‘k’,‘q’,‘nw’, ‘pi’, ‘re’, ‘lev’};
figure

for jj=1:length(var)
subplot(1,2,jj)
eval([‘irf1.’ var{1,jj},ending_cell{1,ii}]);
eval([‘irf2.’ var{1,jj},ending_cell{1,ii}]);
hold on
plot(HOR,[eval([‘irf1.’ var{1,jj},ending_cell{1,ii}])],‘-k’,HOR,[eval([‘irf2.’ var{1,jj},ending_cell{1,ii}])],‘LineWidth’,2.5,‘–r’) ;
end
end

However,it turns out to errors.

Reference to non-existent field ‘y_e_Ne’.

Error in plotfig (line 23)
eval([‘irf1.’ var{1,jj},ending_cell{1,ii}]);

Could anybody give me some hints about how to fix them?
I use the dynare code

“save(‘FACP_results.mat’, ‘oo_’, ‘M_’, ‘options_’)”

and
"save('mpa_k_results.mat', 'oo_', 'M_', 'options_')"
after Bayesian estimation of the two model.
Please help.
God blesses!

Hi,

It is difficult to say anything without the codes. Is e_Ne an exogenous variable in your first model?

Best,
Stéphane.

Yes,it is! e_Ne is standard error of shock u_Ne

u_Ne = rho_Ne*u_Ne(-1)+e_Ne

So the wrong is that I should change the e_Ne into another name?
Then what about another error

Error in plotfig (line 23)
eval([‘irf1.’ var{1,jj},ending_cell{1,ii}]);

Thank you Stepan-a !Sincerely!

Could you please upload the two saved mat-files?

Yes, here they are.mpa_k_results.mat (275.8 KB)
FACP_results.mat (299.3 KB)
Thank you!

The code above was written for IRFs from stoch_simul. For estimation, it would be

ending_cell={'_e_Ne'};
HOR=1:1:40;
var={'y','c','inv','k','q','nw', 'pi', 're', 'lev'};

for ii=1:length(ending_cell)
figure('Name',ending_cell{1,ii})

for jj=1:length(var)
subplot(3,3,jj)
eval(['a=irf1.PosteriorIRF.dsge.Mean.' var{1,jj},ending_cell{1,ii}]);
eval(['b=irf2.PosteriorIRF.dsge.Mean.' var{1,jj},ending_cell{1,ii}]);
hold on
plot(HOR,a,'k-',HOR,b,'r-','LineWidth',2.5) ;
title(var{1,jj})
end
end