%Ten skrypt pokazuje wykres reakcji y na impuls u_d przy ró¿nych
%wartoœciach rho_d, rho_s i rho_i

rho=[0.00 0.25 0.50 0.75]';
horizon=15;
results_y=NaN(horizon,size(rho,1));

for ii=1:size(rho,1)
    delete('rhos.mod')
    fid = fopen('rhos.mod', 'w');
    fprintf(fid, ['rho_d = ' num2str(rho(ii)) ';\n rho_s = ' num2str(rho(ii)) ';\n rho_i = ' num2str(rho(ii)) '; ']);
    fclose(fid);
    save('workspace.mat', 'results_y', 'rho', 'horizon', 'ii');
    dynare NK_serial_correlation
    load('workspace.mat');
    results_y(:,ii)=y_u_d(1:horizon,1);
end

close all
figure(1)
plot(1:horizon,results_y(:,1),...
1:horizon,results_y(:,2),...
1:horizon,results_y(:,3),...
1:horizon,results_y(:,4))
legend('rho=0.00','rho=0.25','rho=0.50','rho=0.75')
title('Response of y to demand shock eps_d: sensitivity to rho')
%axis([0 (max_length-1)  -0.4 0.1]);
%saveas(1,'Graphs/sensitivity_rho.jpg','jpg');