UP=mean(FYUP,3);
DW=mean(FYDW,3);
REUP=mean(FREUP,3);
REDW=mean(FREDW,3);
for t=1:size(REDW,1);
IRFRE(t,:)=(REUP(t,:)+REDW(t,:))./2;
end


clearvars kk kb

irf_l=input('Choose IRFs length: ');
disp('LIST OF VARIABLES')
[num2str([1:neq]'),new_varnames]
nn=input('Give vector of variables # for IRF ==>');
kb=0;
if size(nn,2)<=4
    figure
    for jj=1:size(nn,2)
        subplot(2,2,jj)
       
        plot(IRFRE(nn(jj),block:block+irf_l),'k-.','LineWidth',2)
        hold on
        plot(REUP(nn(jj),block:block+irf_l),'k--','LineWidth',2)
        plot(REDW(nn(jj),block:block+irf_l),'k--','LineWidth',2)
        
       h=ciplot(DW(nn(jj),block:block+irf_l),UP(nn(jj),block:block+irf_l),1:irf_l+1,'b');
        set(h,'FaceAlpha',.3)
       
        xlim([0 irf_l+1]);
        string=['IRF of ',new_varnames(nn(jj),:)];
        title(string);
    end
else
    for jj=1:fix(size(nn,2)/4+1)
        
        figure(jj)
        for kk=1:4
           
        subplot(2,2,kk)
     plot(IRFRE(nn(kk+kb),block:block+irf_l),'k-.','LineWidth',2)
    hold on
     plot(REUP(nn(kk+kb),block:block+irf_l),'k--','LineWidth',2)
     plot(REDW(nn(kk+kb),block:block+irf_l),'k--','LineWidth',2)
      
        h=ciplot(DW(nn(kk+kb),block:block+irf_l),UP(nn(kk+kb),block:block+irf_l),1:irf_l+1,'b');
        set(h,'FaceAlpha',.3)
        
        xlim([0 irf_l+1]);
        string=['IRF of ',new_varnames(nn(kk+kb),:)];
        title(string);
        if kb+kk+1>size(nn,2)
            break
        end
        end
        kb=kb+kk;
        if kb+1>size(nn,2)
            break
        end
    end
end
