From 5c883389659d2cd611f8c20ebbf342894b91e1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Mon, 7 Jan 2013 15:38:45 +0100 Subject: [PATCH] Fix mode_compute=3 under Octave --- matlab/dynare_estimation_1.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m index 457755371d..1f0cc9f9b1 100644 --- a/matlab/dynare_estimation_1.m +++ b/matlab/dynare_estimation_1.m @@ -221,7 +221,14 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation if options_.analytic_derivation, optim_options = optimset(optim_options,'GradObj','on'); end - [xparam1,fval,exitflag] = fminunc(objective_function,xparam1,optim_options,dataset_,options_,M_,estim_params_,bayestopt_,oo_); + if ~exist('OCTAVE_VERSION') + [xparam1,fval,exitflag] = fminunc(objective_function,xparam1,optim_options,dataset_,options_,M_,estim_params_,bayestopt_,oo_); + else + % Under Octave, use a wrapper, since fminunc() does not have a 4th arg + func = @(x) objective_function(x, dataset_,options_,M_,estim_params_,bayestopt_,oo_); + [xparam1,fval,exitflag] = fminunc(func,xparam1,optim_options); + end + case 4 H0 = 1e-4*eye(nx); crit = 1e-7; -- GitLab