Hi AITANAgf,
Drawing extensively on @jpfeifer’s code provided at Discounting under Optimal Monetary Policy, you can place the attached files in your folder and run
dynare fixednew_camilo
fixednew_camilo.mod (7.0 KB)
get_minus_welfare_objective.m (1.7 KB).
Advice 1: explore the sensitivity of your results by using several starting values for the parameters you are optimizing over.
Advice 2: try and impose sensible parameter bounds.