本次代写是一个matlab计量经济学的homework

Consider the dynamics programming problem we discussed in the class:

for all k, and g (k) is the policy function.

1. Solve the above problem using Euler equation. The Euler equation is a nonlinear equation in g (k) and can be solved using the Brent’s method (you can use the Matlab fzero command to solve it). You will also need to approximate the function for its values off the grid points to be able to compute g (g (k)). Use linear interpolation for this. You can use Matlab command interp1 to do this.

2. Plot your solution against the analytical solution.

3. Plot your solution against the analytical solution when you set the number of grid points to be 50 and 10.

4. Repeat steps 1-3 by using spline interpolation instead of linear interpolation to approximate the function. Again you can use Matlab command interp1 for spline interpolation. But this time you need to specify the interpolation method in the command. See the documentation in Matlab for interp1.