Calling Matlab Function before the model block

Can I call a matlab function before the model block? Sorry if I missed something obvious in the manual. Any example could be highly appreciated.

I need to compute parameters to be used in a non-linear model, I do not want to use steady state file. (The reason is that I want to use ramsey_policy, and with steady state file it looks like it assumes that I also provide LM’s steady states which I do not, it gets confused, and I spent way too much time sorting this out. Simply calling matlab function BEFORE the model block would most likely resolve my problems.)

Many many thanks

You should provide a conditional steady state file, i.e. one that provides the steady state values for all endogenous variables conditional on the value of the instruments. You do NOT need to set the steady states of the Lagrange multipliers. Dynare will do this.
An example is at

But this is exactly the example that does NOT work! I am asking this question on that person’s (and my own) behalf. I went through that example - I see that dynare does not even try to find the steady state. It reads some steady state values, assigns zeros to LMs, checks that residuals are not zero, but it does not try to update the LMs. We thought that if we do NOT provide steady state file, but just do initial values guess, then we do not confuse dynare with anything.

So, can I call MATLAB finction BEFORE the model block, please?

I don’t understand your problem. The example for the steady state file with Ramsey itself works, but the model has problems. When you provide a conditional steady state, the problem of finding the steady state for the Lagrange multipliers becomes a linear one that should in theory be very easy to solve. That this is not the case indicates a pathology in the model under consideration. That was why I asked in the referenced post whether we know that such a steady state actually exists.
I don’t know why you think that Dynare does not try to update the LMs. That is the point of the call to dyn_ramsey_static.

What you now are trying to do is run a numerical solver on the full nonlinear Ramsey problem. Given that the easier linear problem cannot be solved, I cannot think of a situation where that would be successful.

Regardless, you can put arbitrary Matlab code before the model-block. If necessary, you may have to put it into a



Many many thanks for this verbatim command. We shall play and see what happens and why the original code had problems in it.
We should handle it now!