% This function finds the non-stochastic steady state using csolve
% Note: output is in logs

% modified: KM 22/06/2005


function [C,K,L,Y,PROD, Cp,Kp,Lp,Yp, PRODp] = SSfinder;
[PAR_alpha, PAR_beta, PAR_delta, PAR_psi, PAR_gamma, PAR_g, PAR_mu,PAR_Lbar, PAR_taulbar, PAR_taux, PAR_rho, PAR_sigmatau, PAR_sigmaz]=parameters;
startvalues=[0.7;7;0.3;1;3];

%1:C 2:K 3:L 4:Y 5: prod

[SS,rc]=csolve(@SSequations,startvalues,[],0.00001,500);
fprintf('\n\nSteady State Values\n');
fprintf('solution achieved = %8.5f\n',rc);
fprintf('0 means normal solution, 4 means itmaxtermination,' );
fprintf(' 1 and 3 mean no solution.\n'); 
fprintf('C = %8.5f\n',SS(1));
fprintf('K = %8.5f\n',SS(2));
fprintf('L = %8.5f\n',SS(3));
fprintf('Y = %8.5f\n',SS(4));
fprintf('Productivity = %8.5f\n',SS(5));



C=log(SS(1)); 
K=log(SS(2)); 
L=log(SS(3)); 
Y=log(SS(4));
PROD=log(SS(5));

Cp=C; Kp=K; Lp=L; Yp=Y; PRODp=PROD;