# M file in dynare model block

Dear all,

I have an equation in the model block of dynare but because of the non-linearity there is no explicit solution for the variable. Basically, I have the same variable in the both side of the equation, which the variable I need to have a solution.

I am not sure if that makes sense, but Can I write an m. file for this equation using fzero matlab command which gives numeric values for the variable and include this m file into the model block?

I am not sure if this idea is applicable

Best

Dear Fery,

I am not sure I understand your problem here. It is perfectly legal to have the same variable on both sides of an equation. When you will simulate the model, you will obtain a solution for the variable (obviously this solution will depend on how you approximate the model).

If you have a matlab function to compute a variable (or a parameter) you can use an external function in the model block (this is described in the reference manual here.

Best,
Stéphane.

Dear Stepan,

Thank you for the answer. I built the model in a way labor shows up as below. I thought that might be the problem why model is not working.

``````L=((1-alpha)*(h1)*Z/((a1-a0)*CW+S))^1/alpha*K
``````

where

``````S=gamma/2*(L/Lss-1)^2
``````

When I run the model it shows that I have problem for three equation out of 16 equation including L.

Maybe that means, even if I have steady state vaule of L, the way it is used in the dynare model block gives some problems ?

Best Regards

What exactly is the error message you are facing?

Hello Dr Pfeifer
When I run the model it can not compute the steay state, there are big residuals for 3 equations, for others zero. The biggest non zero residual is related to the L, I still can not see What the problem this equation might have.

Best

Replacing that equation to an equivalent one will not solve your steady state problems. You should try to compute the steady state analytically.