function [F,irf] = solveadjust_exp1(x,b,A0,N,horizon,target)
K=horizon;
shock=zeros(K+1,N);
shock(1:K+1,1)=x(1:K+1);%PT
shock(1:K+1,2)=x(K+2:end);%CT
irf=zeros(K+1,N);
shockS1=shock(1,:)';
irf(1,:)=shockS1'*A0';
for h=1:K
    B=b{h};
    shockS1=shock(h+1,:)';
    irf(h+1,:)=shockS1'*A0'*B(1:N,:); 
end


%compute objective function
F=[irf(1:K+1,1)' irf(1:K+1,2)']-target;