Your initial value for the instrument `Ds`

was not passed to the steady state file. Also, you did not correctly handle the non-solution of your solvers. It should be:

```
function [ys,check] = Test_file_3_steadystate(ys,exo)
% function [ys,check] = alpha_steadystate(ys,exo)
% computes the steady state for the alpha.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
%
% Output:
% - ys [vector] vector of steady state values fpr the the endogenous variables
% - check [scalar] set to 0 if steady state computation worked and to
% 1 of not (allows to impos restriction on parameteRsss)
global M_
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
varname = deblank(M_.endo_names(ii,:));
eval([varname '= ys(' int2str(ii) ');']);
end
% read out parameteRsss to access them with their name
NumberOfParametes = M_.param_nbr;
for ii = 1:NumberOfParametes
paramname = deblank(M_.param_names(ii,:));
eval([ paramname ' = M_.params(' int2str(ii) ');']);
end
% initialize indicator
check = 0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bank core steady state
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x0=[0.3;1;1.02];
options = optimoptions('fsolve','TolFun',1e-15, 'MaxIter', 1e8,'Display','off','MaxFunctionEvaluations',500);
[xx,fval,exitflag]=fsolve(@bankss, x0, options, betta, sigmma, gama, thetta, Rsss);
if exitflag<1
check=1;
return;
end
x = xx(1);
phi = xx(2);
Rc = xx(3);
R = 1/betta;
psi = thetta*(1+gama*x^2/2)*phi;
mu = betta*(1-sigmma+sigmma*psi)*(Rc-R);
mus = betta*(1-sigmma+sigmma*psi)*(R-Rsss);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% non-bank steady state
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Q = 1;
A = 1;
Rs = Rsss;
Ys = Ysss;
G = Gss;
% Ds = 0; % not sure how to specify Ds in the steady state when it is optimally determined
xx0=[3;2];
[xxx,fval,exitflag]=fsolve(@nobankss, xx0, options, Ysss, alphaK, alphaL, alphaM, sigmmaL, delta, chi, eta, Rc, Rsss, x, Ds);
if exitflag<1
check=1;
return;
end
Y = xxx(1);
e = xxx(2);
Rk = Rc-1+delta;
aky = alphaK/Rk;
K = aky*Y;
L = (alphaL*Y/chi)^(1/(1+sigmmaL));
M = alphaM*Y/e;
EX = e^eta*Ysss;
Bs = Q*K*x/e;
C = Y-delta*K-G-EX;
W = chi*L^sigmmaL;
I = delta*K;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% remaining steady state
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N = Q*K/phi;
B = (1-1/phi-x)*Q*K;
nu = (1-sigmma+sigmma*psi);
T = G+e*Ds-e*Rs*Ds;
utility = log(C-chi*L^(1+sigmmaL)/(1+sigmmaL));
%%
for iter = 1:length(M_.params) % update parameter set in the file
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
end
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
varname = deblank(M_.endo_names(ii,:));
eval(['ys(' int2str(ii) ') = ' varname ';']);
end
```