function [ys,params,check] = sgu_2010_steadystate(ys,exo,M_,options_)
% function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
% computes the steady state for the NK_baseline.mod and uses a numerical
% solver to do so
% Inputs: 
%   - ys        [vector] vector of initial values for the steady state of
%                   the endogenous variables
%   - exo       [vector] vector of values for the exogenous variables
%   - M_        [structure] Dynare model structure
%   - options   [structure] Dynare options structure
%
% Output: 
%   - ys        [vector] vector of steady state values for the the endogenous variables
%   - params    [vector] vector of parameter values
%   - check     [scalar] set to 0 if steady state computation worked and to
%                    1 of not (allows to impose restrictions on parameters)

% read out parameters to access them with their name
NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters
  paramname = M_.param_names{ii};
  eval([ paramname ' = M_.params(' int2str(ii) ');']);
end
% initialize indicator
check = 0;


%% Enter model equations here

options=optimset(); % set options for numerical solver

%% Enter model equations here
% Enter steady state sequentially
n_t = 3/4;
z_bar = 1;
z_t = z_bar;
i_t = i_bar;
%g_bar = 1;
%g_t = g_bar;
tau_t = 0;%0.15;

v_t = sqrt(B/A+i_t/(A*(1+i_t)));
r_t = 1/(1+i_t)-1;
pi_bar = betta/(1+r_t)-1;
pi_t = pi_bar;
mc_t = (1+eta)/eta - (pi_t*(1+pi_t)*(1-betta))/(eta*z_t*n_t);
g_bar = tau_t*z_t*mc_t;
g_t = g_bar;
c_t = (z_t*n_t-(theta/2)*pi_t^2-g_t)/(1+A*v_t+B/v_t-sqrt(A*B));
lambda_t = c_t^(-sig)/(1+2*(A*v_t-sqrt(A*B)));
%tau_t = g_t/(z_t*mc_t);
m_t = c_t/v_t;
zzeta = (c_t^(-sig)*(1+2*(A*v_t-sqrt(A*B))))/((1-n_t)^(-chi)*(1-tau_t)*z_t*mc_t);


% check actual values

%% end own model equations

params=NaN(NumberOfParameters,1);
for iter = 1:length(M_.params) %update parameters set in the file
  eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
  
  %%% mine
  %display(M_.param_names{iter})
end

NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
  varname = M_.endo_names{ii};
  eval(['ys(' int2str(ii) ') = ' varname ';']);

  %%% mine
  %display(varname)
end 
