
% function [ys,check] = NK_IRF_steadystate(ys,exo)
function [ys,params,check] = NK_IRF_steadystate(ys,exo,M_,options_)
% global M_ 

% read out parameters to access them with their name
% NumberOfParameters = M_.param_nbr;
% for ii = 1:NumberOfParameters
%   paramname = deblank(M_.param_names(ii,:));
%   eval([ paramname ' = M_.params(' int2str(ii) ');']);
% end

%%
% make parameter explicitly known to Matlab to avoid naming conflicts; actual value is read out
% in next eval-loop 
delta=0;

% 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


% define parameter and steady state values
param_NK

% export parameters
% nparams = size(M_.param_names,1);
% for icount = 1:nparams
%     eval(['M_.params(icount) = ',M_.param_names(icount,:),';'])
% end

% export steady state values
% nvars = M_.endo_nbr;

% ys = zeros(nvars,1);
% for i_indx = 1:nvars
%    eval(['ys(i_indx)=',M_.endo_names(i_indx,:),';']) 
% end

% nexog = M_.exo_nbr;
% exog = zeros(nexog,1);
% algo = char('active-set', 'trust-region-reflective', 'interior-point', 'interior-point-convex', 'levenberg-marquardt', 'trust-region-dogleg', 'lm-line-search','sqp');
% options = optimset('Display','Iter','Jacobian','on','MaxFunEvals',1e4,'MaxIter',1e4,'TolFun',1e-9,'TolX',1e-9,'Algorithm',algo(5,:));
% ys=fsolve(@(ys) smallmod3_static(ys,exog,M_.params),ys,options);

%Dynare steady state indicator (0 good, 1 bad)

%% 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} ';' ])
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 ';']);
end
