# Plotting multiple IRFs - many endogenous vars

Hello,

I understand that if I want to plot multiple IRFs, I would need to do this on MATLAB. I have generated the code for my model and generated code for my variables from steady state (because I had about 52 endogenous variables but only needed 12 for analysis). I therefore have the following code for them after stoch_simul as plots from deviations from steady state, for example for one variable I have:

``````yepos = strmatch('ye',M_.endo_names,'exact');

set(0,'DefaultAxesTitleFontWeight','normal');

figure('Name','Baseline impulse responses to copper price shock');

subplot(3,4,1);

plot(ye_e/oo_.dr.ys(yepos),'b-','LineWidth',2);

axis tight;

``````

I wanted to please find out if I would be able to transfer these plots onto MATLAB to plot multiple IRFs and if there is any code that would help me with this as I am struggling

Thank you!

Hi m6882,

see my answer to a smiliar question a couple of days ago.
If you only want to plot 12 endogenous variables, the easy way is just to incorporate those in the stoch_simul command and not the others. Something like:` stoch_simul()1 2 ... 12`

Best

Thank you so much! Using this code I was able to do subplots:

``````dynare a.mod;
irf1 = oo_.irfs;
save a.mat irf1;

dynare b.mod;
irf2 = oo_.irfs;
save b.mat irf2;

ending_cell={'_e'};
%'y', 'dp', 'cs', 'cb', 'h', 'hs', 'r', 'qh', 'qz'
for ii=1:length(ending_cell)
HOR=1:options_.irf;
var={'y', 'dp', 'cs', 'cb', 'h', 'hs', 'r', 'qh', 'qz'};
figure
for jj=1:length(var)
subplot(3,4,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}])],'-b',HOR,[eval(['irf2.' var{1,jj},ending_cell{1,ii}])],'--r','LineWidth',2) ;
title([var{1,jj}] )
end
end
``````

I wanted to find out on a few things:

1. is there any way I could compute deviations from steady state?
2. how can I change my labels automatically (i.e. is there any additional code I can use for this)?
3. is there any code I could use to label my x and y axes systematically?
4. I wanted to have boxes/lines within the IRFs, just o be neat - is there any way I could do this?

Thank you