Dynare cannot compute steady state using a separate steadystate.m file

Dear all,

I’m a newbie to Dynare and I’m trying to use it to solve my DSGE model.

I follow the approach in NK_baseline.mod, so I write a nonlinear model in my .mod file and compute the steady state using a separate steadystate.m file, which calls the function fsolve to solve a system of 2 nonlinear equations.

I’m having a trouble running my codes now. It keeps returning the error like this:

Error using trustnleqn (line 28)
Objective function is returning undefined values at initial point. FSOLVE cannot continue.

Error in fsolve (line 368)

Error in Thesis_nln_steadystate (line 104)
[FVAL,fval,exitflag] = fsolve(@F,[0.45;4.5],options);

Error in evaluate_steady_state_file (line 52)
[ys,check] = h_steadystate(ys_init, exo_ss);

Error in evaluate_steady_state (line 212)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,

Error in steady_ (line 55)
[steady_state,params,info] =

Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in Thesis_nln (line 410)

Error in dynare (line 223)
evalin(‘base’,fname) ;

Could anyone please have a look at my codes and help me detect the problem? I’d really appreciate it if you could help me with this.

I’m using Dynare 4.5.4 and Matlab 2015a. Attached here are my codes.

F.m (926 Bytes)
Thesis_nln.mod (9.2 KB)
Thesis_nln_steadystate.m (3.8 KB)

1 Like

Your function F takes an 11 by 1 vector as the input, but you call it with a 2 by 1 vector in the fsolve-command

Thank you for your response. I’ve been trying to change my codes since my last post. Now I need only solve for one variable in the steady state file using fsolve function. So, I don’t use the function .m file anymore. Now it;s shown the residuals of equations, but it also returns the error that it did not compute the steady state like below:

Error using print_info (line 76)
The steadystate file did not compute the steady state

I’ve been changing the initial guess in the _steadystate.m file for many values, but it still shows this error. I wonder if it’s because my initial guess is not good or there’re some command in my codes that cause this error. Can you help me take a look at it?Thesis_nlnbl.mod (10.5 KB)
Thesis_nlnbl_steadystate.m (4.3 KB)

  1. You should work with a proper steady state file instead of manually assigning them to ys.
  2. Only do the exp()-substitution once the steady state works. It is a common mistake to forget the substitution somewhere in the code.
1 Like