>> [alph bet delt gam]
ans =
    0.3000    0.9500         0    2.0000
>> [Cbar Kbar]
ans =
    0.4175    0.1664
>> [Cbar Kbar]=ckss(alph,bet,gam,delt)
Cbar =
    0.4175
Kbar =
    0.1664
>> xbar=log([Cbar;Kbar])
xbar =
   -0.8734
   -1.7932
>> [K1,K2,K3]=ckdf(xbar,xbar,0,alph,bet,gam,delt)
K1 =
    0.4175    0.1664
   11.4734         0
K2 =
         0   -0.1752
  -11.4734    4.0157
K3 =
   -0.5839
   -5.7367
>> [K11,K12,K13,K22,K23,K33]=ckddf(alph,bet,gam,delt)
K11(:,:,1) =
    0.4175         0
  -22.9467         0
K11(:,:,2) =
         0    0.1664
   -0.0000         0
K12(:,:,1) =
  1.0e-009 *
         0         0
   -0.1776         0
K12(:,:,2) =
         0         0
   -8.0314         0
K13 =
         0         0
   11.4735         0
K22(:,:,1) =
         0         0
   22.9467         0
K22(:,:,2) =
         0   -0.0526
         0   -2.8110
K23 =
         0   -0.1752
         0    4.0157
K33 =
   -0.5839
   -5.7367
>> KD={K1,-K2,-K3};
>> KDD={-K11,-K12,-K13;[] -K22 -K23;[] [] -K33};   
>> c=[0;0];Pi=[0;1];pick=[0,1];
>> omega=1;
>> [FD,FDD,M11,M2,C,q,zs,zu,v,gev,eu]=gensys2(KD,KDD,c,Pi,omega,pick)
FD = 
    [0.4191]    [1.3970]    [0.2410]
FDD = 
    [-0.0070]    [-0.0233]
           []    [-0.0778]
M11 =
    0.0044
M2 =
    0.2067
C =
     0
     0
q =
   -0.0604   -0.9982
   -0.9982    0.0604
zs =
    0.5161    0.8565
zu =
   -0.8565    0.5161
v =
   -0.6025   -0.2315
   -1.0000    1.0000
gev =
   -5.9321   -2.4862
   -0.3219   -0.8084
eu =
     1
     1
>> % note that the [0 1] pick matrix makes log K the state variable.  This
% version, with code corrected 12/30/00, matches a solution obtained independently
% by different methods by Jinill Kim and Sunghyun Kim.  
%
%The state variable equation is shown by these results to be
%
%dk(t) = .4191*dk(t-1)+1.3970*a(t)+0.2410*sigma^2
%-.5*0.0070dk(t-1)^2-0.0233*dk(t-1)a(t)-.5*0.0778*a(t)^2
%
%The "policy rule" is
%
%.8565*dc(t)=.5161*dk(t)-.5*0.0044*dk(t)^2-0.2067*sigma^2
