Q: combining IRFs into subplotted figures & iterating?


#21

Without the files to replicate the problem, it is impossible to answer.


#22

Thanks you for responding. Those are the files :
ssfriction_amenage.mod (10.5 KB)
ssfriction_fixe.mod (10.5 KB)


#23

Have not had time to run the code… but did you try

plot(HOR, irf1,..other plot options); hold on;
plot(HOR, irf2...other plot options)

Currently, you are trying to plot HOR on the x axis with 2 variables on the yaxis,using a single plot command…that could explain the error. your syntax seems to be similar to the old plotyy command
https://www.mathworks.com/help/matlab/ref/plotyy.html

Another simple way to do it, would be

plot([irf1 irf2])

if they are of the same lengths…
Reuben


#24

The last part should be


for ii=1:length(ending_cell)
    HOR=1:options_.irf;
    var={'lab','inv'};
    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}]);
        load irf1
        load irf2
        hold on
        plot(HOR,[eval(['irf1.' var{1,jj},ending_cell{1,ii}])],'-k',HOR,[eval(['irf2.' var{1,jj},ending_cell{1,ii}])],'--r','LineWidth',2)
        title([var{1,jj}] )
    end
end

#25

looks like plot(x1,y1,x1,y2) works fine. just checked it.


#26

Thank you so much. My model is working now.