% computes the steady state of dog.mod (growthless deterministic growth model). 
% stephane [DOT] adjemian [AT] ens [DOT] fr

function [ys,check] = paper2_210419_worked_steadystate(ys,exe)
global M_

%% DO NOT CHANGE THIS PART.
%%
%% Here we load the values of the deep parameters in a loop.
%%
NumberOfParameters = M_.param_nbr;                            % Number of deep parameters.
for i = 1:NumberOfParameters                                  % Loop...
  paramname = deblank(M_.param_names(i,:));                   %    Get the name of parameter i. 
  eval([ paramname ' = M_.params(' int2str(i) ');']);         %    Get the value of parameter i.
end                                                           % End of the loop.  
check = 0;
%%
%% END OF THE FIRST MODEL INDEPENDENT BLOCK.


%% THIS BLOCK IS MODEL SPECIFIC.
%%
%% Here the user has to define the steady state.
%%

tstar = (rrho*p_bar+ b_bar/(1-alppha-varrphi))*(1/(rrho*p_bar + b_bar/(rrho*(1+gammaf*e1f)*(1+phif+betta)+(1-rrho)*chi_bar*(1+gammai*e1i)*(1+phii+betta)/thetta - rrho*(1+gammaf*e1f)*b_bar/((alppha*1/kstar^(1-alppha)*hstar^varrphi-deltta)*(1-tstar)*(1+gammaf*e1f)*(1-alppha-varrphi)+p_bar) - (1-rrho)*chi_bar*b_bar/(alppha*1/kstar^(1-alppha*hstar^varrphi)-deltta)*(1-chi_bar*tstar)*(1-alppha-varrphi)))) ;
kstar = (alppha*thetta/deltta*alppha*thetta+p_bar+phif*p_bar+b_bar*thetta)*((1-tstar)*(1+gammaf*e1f)*(1-alppha-varrphi)*kstar^alppha*hstar^varrphi*betta/thetta)-(b_bar*(1-tstar)*(1+gammaf*e1f)*(1-alppha-varrphi)*kstar^alppha*hstar^varrphi/(alppha*(1/kstar^(1-alppha))*hstar^varrphi-deltta)*(1-alppha-varrphi)*(1-tstar)*(1+gammaf*e1f)+p_bar) + (betta*(alppha*1/kstar^(1-alppha)*hstar^varrphi-deltta)*(1-chi_bar*tstar)*(1+gammai*e1i)*(1-alppha-varrphi)*hstar^varrphi/thetta*kstar^(alppha)) ;
hstar =  (hstar^varrphi*kstar^alppha/mmu*thetta*aa*etta)*(phif*(1-tstar)*(1+gammaf*e1f)*(1-alppha-varrphi) +(phii*(1-chi_bar*tstar)*(1+gammai*e1i)*(1-alppha-varrphi)))-(phif*p_bar*kstar/mmu*thetta*alppha*aa*etta) ;
ttau = tstar;
k = kstar;
h= hstar;


%%
%% END OF THE MODEL SPECIFIC BLOCK.


%% DO NOT CHANGE THIS PART.
%%
%% Here we define the steady state values of the endogenous variables of
%% the model.
%%
NumberOfEndogenousVariables = M_.endo_nbr;                    % Number of endogenous variables.
ys = zeros(NumberOfEndogenousVariables,1);                    % Initialization of ys (steady state).
for i = 1:NumberOfEndogenousVariables                         % Loop...
  varname = deblank(M_.endo_names(i,:));                      %    Get the name of endogenous variable i.                     
  eval(['ys(' int2str(i) ') = ' varname ';']);                %    Get the steady state value of this variable.
end                                                           % End of the loop.
%%
%% END OF THE SECOND MODEL INDEPENDENT BLOCK.