Optimal Fiscal and Monetary Policy Under Sticky Prices, Journal of Economic Theory, 114, February 2004, 198-230, by Stephanie Schmitt-Grohe and Martin Uribe

Matlab code
Requirements: (1) Matlab Symbolic Math Toolbox. (2) Toolbox for second-order accurate solution of DSGE models by S. Schmitt-Grohe and M. Uribe.
readme.txt (Brief tutorial)
ramsey_ss.m (Ramsey Steady State)
ramsey_f.m (Ramsey Equilibrium Conditions)
ramsey_run.m (Solution of Ramsey Equilibrium)
ramsey_moments.m (Simulations of the Ramsey Model, tables 2 and 3 in Schmitt-Grohe and Uribe, JET, 2004)
allsyms.m (Definition of Symbolic Variables)