Difficulty in finding steady state with nonlinearity

I have difficulty in finding steady state. I want to set my parameter to make a certain variable equal to some value at the steady state. And I used the “steady_state_model” block to do the calibration. But the parameter and the variable has a nonlinear relationship and I cannot have an analytical solution for the parameter. When I try to use fsolve to get the specific value for the parameter, dynare reports error because one of the static equation does not equal to zero. How can I solve this problem.

This is the model:
((1-phi)/phi)*(1-n)^(-phi)/(c^(phi-1)) = (1-alpha)*y/n

In steady state, I want to have n=1/3 and I already have the value for y. So I need to solve for phi in this case. But I cannot give phi an analytical expression.

you can solve this problem using the following way:




then you should build a file named find_phi.m

function phi=find_phi(n,c,alp,y);

phi=fsolve(@(phi) ((1-phi)/phi)*(1-n)^(-phi)/(c^(phi-1))-(1-alpha)*y/n,0.5);

Please take a look at example3.mod in the Dynare examples folder, which does exactly what jameszhow1985 proposes.

Thank you so much for the timely help!!!