The following question requires you to write MATLAB (not pseudo)... Assume a momentary objective function of the form

advertisement
The following question requires you to write MATLAB (not pseudo) code.
Assume a momentary objective function of the form
U (k; k 0 ) = ln(k + (1
)k
k 0 ):
Write out the computer code using MATLAB syntax for solving the dynamic
programming problem
V (k) =
max fU (k; k 0 ) + V (k 0 )g:
k0 2[k1 ;kn ]
In the above dynamic programming problem (to be solved on the computer),
the choice variable, k 0 , is to formulated as continuous variable, not discrete one.
The value function V (k) is to be approximated by piecewise linear functions on
the grid K = fk1 ;
; kn g; i.e., between any two grid points, say kj and kj+1 ,
the function V is approximated by a linear function on the interval [kj ; kj+1 ].
Assume = 0:3, = 0:1, = 0:96. Assume that the grid spans 10,001 points
centered on the steady-state value for capital, k , spanning the interval [k
:5k ; k + :5k ].
Hint 1 : Suppose one has the values for a function V on the grid K. Code
up the piecewise linear approximation to V .
Hint 2 : The following information in MATLAB may help:
fminbnd: …nds the minimum of a function of one variable within a …xed
interval.
x = fminbnd(fun,x1,x2) returns a value x that is a local minimizer of the
function that is described in fun in the interval x1 < x < x2. fun is a function_handle.
1
Download