# Solving for Steady State with an external matlab file

**URL:** <https://forum.dynare.org/t/solving-for-steady-state-with-an-external-matlab-file/3013>\
**Category:** Dynare help (legacy posts)\
**Created:** [13 March 2013 04:33 UTC](https://forum.dynare.org/t/solving-for-steady-state-with-an-external-matlab-file/3013 "2013-03-13T04:33:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zsk3](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/e5b9ba/32.png) [@zsk3](https://forum.dynare.org/u/zsk3)\
**Post date:** [13 March 2013 04:33 UTC](https://forum.dynare.org/t/solving-for-steady-state-with-an-external-matlab-file/3013/1 "2013-03-13T04:33:39Z")

</div>

Hi,

I can find the solution to the steady state of my model using two matlab files. Since my steady state equations are nonlinear, I’m using fsolve. fertility1\_steadystate.m and steady\_state.m codes work fine for finding the steady state solutions, however I couldn’t find a way to make the .mod file get the results. I think Dynare has a problem on calling a function that depends on another function. What would you suggest me to do?

Thank you for your concern.  
[steady\_state.m](https://forum.dynare.org/uploads/default/original/2X/8/8c98a61a7a31490d8fb9bc7dfbea7ac66420e744.m) (834 Bytes)  
[fertility1\_steadystate.m](https://forum.dynare.org/uploads/default/original/2X/1/1fbbf6b4116988205b8df35a7445bffff847dfa6.m) (267 Bytes)  
[fertility1.mod](https://forum.dynare.org/uploads/default/original/2X/4/4c50d9822298c5fe82a4f4e6b465af74aa7b810a.mod) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [13 March 2013 07:39 UTC](https://forum.dynare.org/t/solving-for-steady-state-with-an-external-matlab-file/3013/2 "2013-03-13T07:39:53Z")

</div>

Write and use a correct steady state file, see [[Steady state file](https://forum.dynare.org/t/steady-state-file/782/1))

---

<div class="post-metadata">

**Author:** ![zsk3](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/e5b9ba/32.png) [@zsk3](https://forum.dynare.org/u/zsk3)\
**Post date:** [13 March 2013 20:57 UTC](https://forum.dynare.org/t/solving-for-steady-state-with-an-external-matlab-file/3013/3 "2013-03-13T20:57:43Z")

</div>

Hi,

Thank you for your prompt reply. I studied over the steadystate files in the link. I realized that in the steady state equations, each variable is defined in terms of the variables defined before. Therefore the equations are simple enough. In my model, at least three variables are defined with equations that are highly nonlinear, so it is not possible for me to write an equation for each variable one at a time. This is why I solved for the steady state using an external matlab code. Does Dynare offer any solutions for complex steady states?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [13 March 2013 21:26 UTC](https://forum.dynare.org/t/solving-for-steady-state-with-an-external-matlab-file/3013/4 "2013-03-13T21:26:47Z")

</div>

The SS-file passes the parameters from Dynare to your code and then back to Dynare. Within the block given by the SS-file you can execute any code in whatever order you like as long as at the end of your computation all SS-values have have been set. You can easily call other functions like the one you wrote or numerical optimizers within your steady state file.
