% Basic RBC Model 

close all

% 1. Defining variables

var y c k i l z;
varexo e;

parameters beta psi delta alpha rho;

% 2. Calibration

alpha   = 0.33;
beta    = 0.99;
delta   = 0.02;
psi     = 1.75;
rho     = 0.95;

% 3. Model

model; 
  (1/c) = beta*(1/c(+1))*(1+alpha*(k^(alpha-1))*(exp(z(+1))*l(+1))^(1-alpha)-delta);
  psi*c/(1-l) = (1-alpha)*(k(-1)^alpha)*(exp(z)^(1-alpha))*(l^(-alpha));
  c+i = y;
  y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);
  i = k-(1-delta)*k(-1);
  z = rho*z(-1)+e;
end;

% 4. Computation

initval;
  k = 9;
  c = 0.76;
  l = 0.3;
  z = 0; 
  e = 0;
end;

% 5. Steady state

steady;