function [ys,check] = q11_steadystate(junk,ys)
  global BET   ALPHA_H ALPHA_F GAMMA_H GAMMA_F KAPPA_H    KAPPA_F     SIGMA_H     SIGMA_F  ETA_H ETA_F MU_H MU_F ...
               THETA_H THETA_F DELTA_H DELTA_F LAMBDA_H_H LAMBDA_H_F  LAMBDA_F_H  LAMBDA_F_F                     ...  
               RHO_H_H RHO_H_F RHO_F_H RHO_F_F FI_H       FI_F        PSI_H       PSI_F                          ...
               MGROWTH_H  MGROWTH_F  SHARE_I_H SHARE_I_F  SHARE_C_H_H SHARE_C_F_F N_BAR_H N_BAR_F                ...
        RHO_A11  RHO_A12                    RHO_A21  RHO_A22                    SIGMA_A_H  SIGMA_A_F  CORR_A ...
        RHO_DM11 RHO_DM12 RHO_DM13 RHO_DM14 RHO_DM21 RHO_DM22 RHO_DM23 RHO_DM24 SIGMA_DM_H SIGMA_DM_F CORR_DM ...
        POWER1_H POWER2_H POWER3_H POWER4_H POWER5_H POWER1_F POWER2_F POWER3_F POWER4_F POWER5_F CHI_H CHI_F ZETA_H ZETA_F UPS_H UPS_F;

check = 0;

%// Setting parameters
BET         = 1.04^(-0.25);

% First subscript is where consumed.  Second subscript is origin of good.
SHARE_C_H_H = 0.45 ;
SHARE_C_F_F = 0.45;

%// investment as a share of output
SHARE_I_H   = 0.1 ;
SHARE_I_F   = 0.1;

%// steady state percentage hours worked
N_BAR_H     = 0.20;
N_BAR_F     = 0.20;

%// 1 plus quarterly rate of nominal money growth
MGROWTH_H = 1.0125;
MGROWTH_F = 1.0125;

ALPHA_H     = 0.25 ;
ALPHA_F     = 0.25 ;
GAMMA_H     = 05.00 ;
GAMMA_F     = 05.00 ;
KAPPA_H     = 0.10;
KAPPA_F     = 0.10;
ETA_H       = 0.39;
ETA_F       = 0.39;
MU_H        = 0.05; 
MU_F        = 0.05; 
SIGMA_H     = 2.0 ;
SIGMA_F     = 2.0 ;
PSI_H       = 1.0;
PSI_F       = 1.0;
THETA_H     = 3.00;
THETA_F     = 3.00;

% Investment adjustment cost parameters and is 0 <= CHI 
CHI_H      = 0.00;
CHI_F      = 0.00;

% Capital adjustment cost parameters and 0 < UPS <= 1
UPS_H      = 1.00; 
UPS_F      = 1.00;

% Capital and/or Investment adjustment cost parameters and 0 <= ZETA <= 1
ZETA_H     = 1.000; 
ZETA_F     = 1.000; 


% First subscript is where consumed.  Second subscript is origin of good.
LAMBDA_H_H  = 0.500 ;
LAMBDA_H_F  = 0.500 ;

LAMBDA_F_H  = 0.500 ;
LAMBDA_F_F  = 0.500 ;

RHO_H_H     = 0.85 ;
RHO_H_F     = 0.85 ;

RHO_F_H     = 0.85 ;
RHO_F_F     = 0.85;


RHO_DM11   = 0.50; 		
RHO_DM12   = 0.0; 		
RHO_DM13   = 0.0; 		
RHO_DM14   = 0.0; 		
RHO_DM21   = 0.0; 		
RHO_DM22   = 0.50; 		
RHO_DM23   = 0.0; 		
RHO_DM24   = 0.0; 		
	

RHO_A11   = 0.500;
RHO_A12   = 0.00;
RHO_A21   = 0.00;
RHO_A22   = 0.500;

SIGMA_A_H   = 0.01;
SIGMA_A_F   = 0.01;
CORR_A      = 0.00;
SIGMA_DM_H  = 0.01;
SIGMA_DM_F  = 0.01;
CORR_DM     = 0.00;

%//Calculating the steady state:


R_INT_BAR_H = 1.0/BET - 1;
R_INT_BAR_F = 1.0/BET - 1; 

N_INT_BAR_H = (1+R_INT_BAR_H)*MGROWTH_H-1;
N_INT_BAR_F = (1+R_INT_BAR_F)*MGROWTH_F-1;

DELTA_H = (1/BET-1)/(ALPHA_H/SHARE_I_H-1);
DELTA_F = (1/BET-1)/(ALPHA_F/SHARE_I_F-1);

R_K_BAR_H   = 1/BET - (1-DELTA_H);
R_K_BAR_F   = 1/BET - (1-DELTA_F);


K_BAR_H     = (R_K_BAR_H/ALPHA_H)  ^(1/(ALPHA_H-1))*N_BAR_H;
K_BAR_F     = (R_K_BAR_F/ALPHA_F)  ^(1/(ALPHA_F-1))*N_BAR_F;

W_BAR_H     = (1-ALPHA_H)*(K_BAR_H/N_BAR_H)^ALPHA_H;
W_BAR_F     = (1-ALPHA_F)*(K_BAR_F/N_BAR_F)^ALPHA_F;

Y_BAR_H     = K_BAR_H^ALPHA_H  *N_BAR_H^(1-ALPHA_H); 
Y_BAR_F     = K_BAR_F^ALPHA_F  *N_BAR_F^(1-ALPHA_F);

I_BAR_H     = SHARE_I_H *Y_BAR_H;
I_BAR_F     = SHARE_I_F *Y_BAR_F;

% First subscript is where consumed.  Second subscript is origin of good.
C_BAR_H_H   = SHARE_C_H_H *Y_BAR_H;
C_BAR_F_H   = Y_BAR_H - C_BAR_H_H - I_BAR_H;

C_BAR_F_F   = SHARE_C_F_F *Y_BAR_F;
C_BAR_H_F   = Y_BAR_F - C_BAR_F_F - I_BAR_F;

% Steady state habits for home goods
H_BAR_H_H   = C_BAR_H_H;
H_BAR_F_H   = C_BAR_F_H;
% Steady state habits for foreign goods
H_BAR_F_F   = C_BAR_F_F;
H_BAR_H_F   = C_BAR_H_F;

POWER2_H = (THETA_H-1) / THETA_H;
POWER2_F = (THETA_F-1) / THETA_F;
POWER3_H = (ETA_H-1)   / ETA_H;
POWER3_F = (ETA_F-1)   / ETA_F;
POWER1_H = POWER3_H / POWER2_H;
POWER1_F = POWER3_F / POWER2_F;
POWER4_H = (1-SIGMA_H)/POWER3_H;
POWER4_F = (1-SIGMA_F)/POWER3_F;

POWER5_H = KAPPA_H*GAMMA_H/(1-SIGMA_H);
POWER5_F = KAPPA_F*GAMMA_F/(1-SIGMA_F);

SRT_BAR   = PSI_H*C_BAR_H_F^((1-LAMBDA_H_F)*POWER2_H-1)/(C_BAR_H_H^((1-LAMBDA_H_H)*POWER2_H-1));

A_H_BAR  = C_BAR_H_H^((1-LAMBDA_H_H)*POWER2_H) + PSI_H * C_BAR_H_F^((1-LAMBDA_H_F)*POWER2_H); 
A_F_BAR  = C_BAR_F_F^((1-LAMBDA_F_F)*POWER2_F) + PSI_F * C_BAR_F_H^((1-LAMBDA_F_H)*POWER2_F); 

M_BAR_H = ((MU_H*(1+N_INT_BAR_H)/N_INT_BAR_H) *C_BAR_H_H^(1-(1-LAMBDA_H_H)*POWER2_H)*A_H_BAR^(1-POWER1_H))^(ETA_H);
M_BAR_F = ((MU_F*(1+N_INT_BAR_F)/N_INT_BAR_F) *C_BAR_F_F^(1-(1-LAMBDA_F_F)*POWER2_F)*A_F_BAR^(1-POWER1_F))^(ETA_F);

B_H_BAR  = A_H_BAR^POWER1_H  +  MU_H*M_BAR_H^POWER3_H;
B_F_BAR  = A_F_BAR^POWER1_F  +  MU_F*M_BAR_F^POWER3_F;

FI_H  = W_BAR_H*(1-N_BAR_H)*C_BAR_H_H^((1-LAMBDA_H_H)*POWER2_H-1)*A_H_BAR^(POWER1_H-1)/B_H_BAR;
FI_F  = W_BAR_F*(1-N_BAR_F)*C_BAR_F_F^((1-LAMBDA_F_F)*POWER2_F-1)*A_F_BAR^(POWER1_F-1)/B_F_BAR;           

X_BAR_H = (B_H_BAR ^(1/POWER3_H)) *(1-N_BAR_H)^FI_H;
X_BAR_F = (B_F_BAR ^(1/POWER3_F)) *(1-N_BAR_F)^FI_F;

U_X_BAR_H =X_BAR_H^(-SIGMA_H)*(1-POWER5_H*(X_BAR_H^(1-SIGMA_H)-1))^(1/KAPPA_H-1);
U_X_BAR_F =X_BAR_F^(-SIGMA_F)*(1-POWER5_F*(X_BAR_F^(1-SIGMA_F)-1))^(1/KAPPA_F-1);

u_c_h_h_BAR =         C_BAR_H_H^((1-LAMBDA_H_H)*POWER2_H-1)           *A_H_BAR^(POWER1_H-1)/B_H_BAR * X_BAR_H*U_X_BAR_H ;
u_c_f_f_BAR =         C_BAR_F_F^((1-LAMBDA_F_F)*POWER2_F-1)           *A_F_BAR^(POWER1_F-1)/B_F_BAR * X_BAR_F*U_X_BAR_F ;
u_c_h_f_BAR = PSI_H * C_BAR_H_F^((1-LAMBDA_H_F)*POWER2_H-1)           *A_H_BAR^(POWER1_H-1)/B_H_BAR * X_BAR_H*U_X_BAR_H ;
u_c_f_h_BAR = PSI_F * C_BAR_F_H^((1-LAMBDA_F_H)*POWER2_F-1)           *A_F_BAR^(POWER1_F-1)/B_F_BAR * X_BAR_F*U_X_BAR_F ;
u_m_h_BAR   =                MU_H/(M_BAR_H^(1/ETA_H))                                      /B_H_BAR * X_BAR_H*U_X_BAR_H ;
u_m_f_BAR   =                MU_F/(M_BAR_F^(1/ETA_F))                                      /B_F_BAR * X_BAR_F*U_X_BAR_F ;
u_n_h_BAR   =                      -FI_H/(1-N_BAR_H)                                                * X_BAR_H*U_X_BAR_H ;
u_n_f_BAR   =                      -FI_F/(1-N_BAR_F)                                                * X_BAR_F*U_X_BAR_F ;



W_BAR_H   = (1-ALPHA_H)*(K_BAR_H/N_BAR_H)^ALPHA_H
W_BAR_H1  = -u_n_h_BAR   / u_c_h_h_BAR

ii1_BAR_H1  = u_m_h_BAR   / u_c_h_h_BAR
ii2_BAR_H1  = N_INT_BAR_H/(1+N_INT_BAR_H)

SRT_BAR   = PSI_H*C_BAR_H_F^((1-LAMBDA_H_F)*POWER2_H-1)/(C_BAR_H_H^((1-LAMBDA_H_H)*POWER2_H-1))
srt1_bar  =  PSI_H*u_c_h_h_BAR   / u_c_h_f_BAR
 

a_h       = 0;
a_f       = 0;
c_f_h     = log(C_BAR_F_H) ;
c_f_f     = log(C_BAR_F_F); 
c_h_h     = log(C_BAR_H_H) ;
c_h_f     = log(C_BAR_H_F) ;
dm_h      = 0;
dm_f      = 0;
h_f_h     = log(C_BAR_F_H); 
h_f_f     = log(C_BAR_F_F); 
h_h_h     = log(C_BAR_H_H); 
h_h_f     = log(C_BAR_H_F); 
i_h       = log(I_BAR_H);
i_f       = log(I_BAR_F);
k_h       = log(K_BAR_H);
k_f       = log(K_BAR_F);
m_h       = log(M_BAR_H);
m_f       = log(M_BAR_F);
n_h       = log(N_BAR_H);
n_f       = log(N_BAR_F);
n_int_h   = (MGROWTH_H/BET-1);
n_int_f   = (MGROWTH_F/BET-1);
p_i_f     = 0.0 ;
p_i_h     = 0.0 ;
pie_h     = MGROWTH_H -1;
pie_f     = MGROWTH_F -1;
r_int_h   = (1/BET-1);
r_int_f   = (1/BET-1);
s_r_t     = log(SRT_BAR); 
u_c_h_h   = u_c_h_h_BAR;
u_c_h_f   = u_c_h_f_BAR;
u_m_h     = u_m_h_BAR;
u_n_h     = u_n_h_BAR;
u_c_f_h   = u_c_f_h_BAR; 
u_c_f_f   = u_c_f_f_BAR ;
u_m_f     = u_m_f_BAR ;
u_n_f     = u_n_f_BAR;
w_h       = log(W_BAR_H);
w_f       = log(W_BAR_F);
y_h       = log(Y_BAR_H);
y_f       = log(Y_BAR_F);
 


%ds

ys =[
a_f    
a_h       
c_f_f   
c_f_h     
c_h_f     
c_h_h   
dm_f
dm_h 
h_f_f   
h_f_h     
h_h_f     
h_h_h   
i_f       
i_h     
k_f       
k_h     
m_f       
m_h
n_f       
n_h 
n_int_f   
n_int_h 
p_i_f 
p_i_h 
pie_f 
pie_h
r_int_f   
r_int_h 
s_r_t  
u_c_f_f 
u_c_f_h
u_c_h_f  
u_c_h_h   
u_m_f   
u_m_h   
u_n_f  
u_n_h  
w_f       
w_h     
y_f       
y_h     
     ];
