Undefined function or variable 'kstar' when run the external steady state .m file

Dear all,

I am new to Dynare and trying to run the external steady state.m file for my 2 period-OLG model. However, this undefined function error shows up. If I run the mod. file without external steady state.m file, it does work, also when I try to solve the steady state by fsolve, it finds numerical solutions for the steady state.

I checked some of the legacy posts, still I couldn’t solve the problem. The error message are follows.

Undefined function or variable ‘kstar’.

Error in paper2_210419_worked_steadystate (line 26)
tstar = (rrhop_bar+ b_bar/(1-alppha-varrphi))(1/(rrhop_bar +
(1+gammafe1f)(1+phif+betta)+(1-rrho)chi_bar(1+gammaie1i)(1+phii+betta)/thetta -

  • (1-rrho)chi_barb_bar/(alppha1/kstar^(1-alpphahstar^varrphi)-deltta)(1-chi_bartstar)*(1-alppha-varrphi)))) ;

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, options,steadystate_check_flag);

Error in steady_ (line 55)
[steady_state,params,info] = evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);

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

Error in paper2_210419_worked (line 310)

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

Thank you very much in advance for your help.

paper2_210419_worked_steadystate.m (2.8 KB)
paper2_210419_worked.mod (9.1 KB)

Your file does not provide a proper steady state. In the definition of tstar you rely on kstar, but you only compute that later on.

Thank you very much for your prompt response, Prof.Pfeifer. I have 3 steady states of 3 endogenous variables e.g. tau = f(tau, k, h; exogenous and parameters) , k=f1(tau, k,h ; exogenous and parameters) and h =f2(tau, k , h; exogenous and parameters).
So, I am not sure how I can provide a k without tau.
Can Dynare solve system of equations simultaneously in the external steady state file?

Thank you again for your support.

The steady state file is a Matlab file. In that case, you need to use Matlab’s solvers to solve that equation system. An example is at https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2010/Gali_2010_calib_target_steadystate.m