function [ys,check]=baby00_steadystate(junk,ys);

global M_

paramfile_baby00

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

check = 0;

r = PIBAR / BETA ;
rk = r / BETA - (1-DK);
xp = XP_SS;
xw = XW_SS;
xw1 = XW_SS;
lm = (1-BETA1/BETA) / (1-BETA1*RHOB/PIBAR);

%QHTOC = (JEI*RHOD) /((1-BETA)*(1-n)^((1-RHOD)*(1-VARTHETA))); %eq(1)
%QH1TOC1 = (JEI*RHOD) /((1 - BETA1 - lm*(1-RHOD)*M)*1/(1-n1)^((1-RHOD)*(1-VARTHETA))); % Eq(5)

KTOY = (ALPHA/(xp*rk)); 
B1TOQH1 = (M*(1 - RHOB))/(1-(RHOB/PIBAR)) ; 
WNTOY = (1-ALPHA)*(1-SIGMA)/xp;
TTOY = (1/BETA-1)*BGTOY+GTOY;

X0 = [10; 10; 1; 1; 1; 1; 10; 10; 0; 0;];%initial values
options = optimoptions('fsolve','Display','iter');
[X,fval] = fsolve(@findSS,X0,options); %Fsolve løser 6 ligninger med 6 ubekendte simultant.

QHTOC = X(1);
QH1TOC1 = X(2);
n = X(3);
n1 = X(4);
CTOY = X(5);
C1TOY = X(6);
y = X(7);
q = X(8);
h = X(9);
h1 = X(10);

%C1TOY = (((1-ALPHA)*SIGMA*(1/xp) - SIGMA*TTOY)/(1+(1/BETA-1)*B1TOQH1*QH1TOC1)); %eq(4)
%CTOY = (1-C1TOY-DK*KTOY-GTOY);  %eq(3)


BTOY = 1/(1-1/BETA)*(CTOY - WNTOY - rk*KTOY + DK*KTOY - (xp-1)/xp + (1-SIGMA)*TTOY) ;

%n = ((1-SIGMA)*(1-ALPHA)*(1/(xp*xw*((1-RHOD)/RHOD)*CTOY)))*(xp*xw*((1-RHOD)/RHOD)*CTOY*(1/((1-SIGMA)*(1-ALPHA)+1))); %Eq(2)
%n1 =((1-SIGMA)*(1-ALPHA)*(1/(xp*xw1*((1-RHOD)/RHOD)*C1TOY)))*(xp*xw1*((1-RHOD)/RHOD)*C1TOY*(1/((1-SIGMA)*(1-ALPHA)+1))); %Eq(6)

B1TOY = B1TOQH1*QH1TOC1*C1TOY;
%y = KTOY^(ALPHA/(1-ALPHA))*n^(1-SIGMA)*n1^(SIGMA); %Eq 7
c = CTOY*y;
c1 = C1TOY*y;
k = KTOY*y;
ik = DK*k;

w = xw * ((1-RHOD)/RHOD)*(c/(1-n));
w1 = xw1 * ((1-RHOD)/RHOD)*c1/(1-n1);
%q = QHTOC*CTOY*y+QH1TOC1*C1TOY*y; eq 8
%h = QHTOC*c/q; eq 9 
%h1 = QH1TOC1*c1/q; eq 10
b = BTOY*y;
bg = BGTOY*y ;
b1 = - b - bg;
uc = RHOD*c^(RHOD*(1-VARTHETA)-1)*(1-n)^((1-RHOD)*(1-VARTHETA));
uc1 = RHOD*c1^(RHOD*(1-VARTHETA)-1)*(1-n1)^((1-RHOD)*(1-VARTHETA));
uh = JEI/h;
uh1 = JEI/h1;
dp = PIBAR ;
dp1 = dp;
dp2 = dp;
dp3 = dp;
dw = PIBAR;
dw1 = PIBAR;    
aa = 1;
af = 1;
aj = 1;
am = 1;
arr = 1; 
az = 1;
ak = 1;
ap = 1;
aw = 1;
an = 1;

qk = 1;
rnot = r;
lev = b1/(q*h1); 
bnot = b1;
maxlev = 0;

data_ntot=0;

z_j=0;

%Government

g = GTOY*y;
t = TTOY*y; 
bg = BGTOY*y;


ys = [ 
aj
ak
ap
arr
aw
az
b1
bg
bnot
c    
c1 
data_ntot
dp 
dw
dw1
g
h1
ik
k
lm
maxlev
n    
n1  
q    
qk
r    
rk
rnot
t
uc   
uc1  
uh
uh1
w    
w1   
xp   
xw   
xw1  
y 
z_j ];
