
function [out,tmp]=getexpresponse(K1P_cP,A0,horizon,bb,minh,maxh,dt)
N=cols(A0);
 shock=zeros(1,N);
 shock(1)=1;
 irfmp=irfsimx(K1P_cP',N,1,A0,shock,horizon+maxh,0);
 irfSR=irfmp(:,1:N)*bb(2:end);%+bb(1);
 irfSR=irfSR./irfSR(1,1);
 tmp=[irfSR];
    for h=1:(horizon+maxh)-1
        tmp=[tmp lagmatrix(irfSR,-h)]; %[irf irf(+1) irf(+2)....irf(horizon-1)] mean of cols gives response of yield
    end
    
    out=mean(tmp(1:horizon,minh:maxh),2)*dt;