Optimizers and conflict with dynare versions

Hello there

I was looking in the forum on how to find the optimal parameters of a simple monetary policy rule for a nonlinear model (complete welfare analysis), I found the code that professor Pfeifer shared a long time ago to implement csminwel, however, I tried to implement it in recent versions of dynare and it throws me an error. I identified that the problem is due to the changes that were implemented since dynare 4.6 , because if I use the code in version 4.5.6 I don’t have any problem. I changed a line to make it consistent with recent versions, but the error persists, could someone please take a look at it to see what else I need to update? The part of the code that goes in the mod file is:

stoch_simul(order=2, irf=0);

options_.noprint=1;

x_start=[1.5, 0.5, 0.05, 0.75]';
%define parameters to be optimized and their upper and lower bound
x_opt_name={‘phi_pi’,1,3
‘phi_y’,0, 3
‘phi_ds’,0,3
‘phi_r’, 0, 1
};

options_.nofunctions=1;
options_.nograph=1;
options_.verbosity=0;

%set noprint option to suppress error messages within optimizer
options_.noprint=1;
options_.TeX=0;
% set csminwel options
H0 = 1e-2*eye(length(x_start)); %Initial Hessian
crit = 1e-8; %Tolerance
nit = 1000; %Number of iterations
[fhat,x_opt_hat] = csminwel(@welfare_objective,x_start,H0,[],crit,nit,x_opt_name);

and I attach the .m file (the error i get is: Not enough input arguments.)
Thanks in advance
conditional_welfare_objective.m (1.2 KB)
welfare_objective.m (1.2 KB)

You can see the relevant change at Update repository to Dynare 4.6 · JohannesPfeifer/DSGE_mod@5a97320 · GitHub

The call to simult_ should be

y_sim = simult_(M_,options_,initial_condition_states,oo_.dr,shock_matrix,options_.order); %simulate one period to get value