# First time using fsolve

Dear all,

I´m new to dynare(and matlab) and i´m trying to calculate the steady state of my model. Since my model have a lot of nonlinear equations i want to solve for the steady state using an external matlab code(fsolve) to find the steady state of all the equilibrium equations of my model. My question is how should i input the equations in the .m steady state file so i can get the steady state of all variables using fsolve(i dont wanna write each variable in the .m file as defined in terms of the variables defined before, since the equations are highly nonlinear)?Basically, my question is how should i input all my model equilibrium equations in the steady state .m file?

I know i should rewrite all equations so they are in the form F(x) = 0. My questions are: what should i do with lagged variables and steady state terms? For example, please look at this equations:

1. k = i + ( 1 - delta)*k(-1); ** Should i put all variables in the steady state so k = k(-1) = k and rewrite all the other equations in this fashion?

Another problem is that some equations of my model have steady state terms(taylor rule and some shock equations):

1. ln(R/R_ss) = alfa_r* ln(R(-1)/R_ss) + (1 - alfa_r)(alfa_piln(Pi/Pi_ss) + alfa_y*ln(y/y_ss)) + e_r; **How should i rewrite this equation,so i can solve the steady state of my model using fsolve?

Thanks.

Why would you want to do that? Dynare itself already has a numerical solver for finding the steady state. Unless you manually simplify your steady state to make the problem lower-dimensional (like breaking it down to one nonlinear equation as is done in the NK_baseline.mod in the Dynare examples folder), you do not gain anything by using a steady state file.

Hi,

Thank you for your prompt reply. I tought that solving for the steady state using fsolve(with a .m stead statle file, instead of using dynare numeric solver)was better, since i didn´t need to have reliable initial values for the variables( i know you need to give starting points while using fsolve, but i tought it didnt need to be as accurate as when using dynare).

To clarify my situation, i´m trying to run a dsge model for my master´s degree(i attached my code) and i log-linearized the model(as i didn´t know the ss values of the variables).However, some of my original (non-linear) equations involve sums, so some of my linearized equations have ratios of steady state values. So i tried to provide the initial values for this steady state variables( in the parameter block of the mod file, as the model is log-linearized), but i think my guesses weren´t that good( i got some from the literature, some from the original paper and some were guesses) as i ran into a problem with BK violated condiditions(more eigenvalues larger than 1 than forward variables) and i think the problem is probably caused by my choices to steady state of the variables .So i tought if a created a .mod file ,to calcultate the steady state of all my model equations(not log-linearized), i could find the ss and solve this problem…

Thanks,