Error in discretionary_policy command

I’m running a program to figure out the simplest optimal discretionary policy, but Matlab showed me these errors:
discretionary_policy_1 (line 71)
discretionary_policy: the objective function must have zero first order derivatives

stoch_simul (line 82)
[oo_.dr,ys,info] = discretionary_policy_1(oo_,options_.instruments);

discretionary_policy (line 25)
info = stoch_simul(var_list);

(line 163)

dynare (line 235)
evalin(‘base’,fname) ;

My objective function is really simple and purely quadratic, I don’t know why I got these errors, could you help me with this? I have attached my mod file.Q4.mod (880 Bytes)

Did you have a small typo error? In the attached .mod file, instead of commenting out “FOC under discretionary policy” with a “%”, you attempted to comment it out with a “$”, which I think matlab will try to interpret incorrectly. I’d say replace the “$” with a “%” and try to run it again.

For some reason, your last line of parameter definitions is not correctly parsed. Putting one parameter in one line seems to work.
Q4_disc.mod (870 Bytes)