%compute the steady state of RBC Model 
function[ys,check]=nonline_stoc_6_steadystate(ys,exe)
global M_
 
%% DO NOT CHANGE THIS PART.
%%
%% Here we load the values of the deep parameters in a loop.
%%
NumberOfParameters = M_.param_nbr;                            % Number of deep parameters.
for i = 1:NumberOfParameters                                  % Loop...
  paramname = deblank(M_.param_names(i,:));                   %    Get the name of parameter i. 
  eval([ paramname ' = M_.params(' int2str(i) ');']);         %    Get the value of parameter i.
end                                                           % End of the loop.  
check = 0;
%%


%% THIS BLOCK IS MODEL SPECIFIC.
%%
%% Here the user has to define the steady state.
%%
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Y=1;
C=Y;
uc=C^(-gama);
Lambda=pbeta*uc/uc; 
S_1=Lambda;
R=1/Lambda; 
R1=R;
Omega=@(phi,N) sigmaa+(1-sigmaa)*theta*phi; 

a=@(phi,N) S_1*R1*Omega(phi,N);
b=@(phi,N) Lambda*Omega(phi,N)*(phi*N+Y);
M1=@(phi,N) phi-(b(phi,N)+N*a(phi,N))/(N*(a(phi,N)+theta));


c=@(phi,N) (1-sigmaa)*(Y-R*N*(phi-1))+sigmaa*Nn;
d=1-sigmaa;
M2=@(phi,N) N-c(phi,N)/(1-d*phi);
 
%%
MN1=@(phi,N) [M1(phi,N),M2(phi,N)];
[V,fval]=fsolve(@(x) MN1(x(1),x(2)) ,[1,100]);
%%

phi=V(1);
N=V(2);
Omega= sigmaa+(1-sigmaa)*theta*phi; 

a= S_1*R1*Omega;
b= Lambda*Omega*(phi*N+Y);
c=(1-sigmaa)*(Y-R*N*(phi-1))+sigmaa*Nn;
Q=phi*N;
D=(phi-1)*N;
%********************

%  ***********************
 



%% END OF THE MODEL SPECIFIC BLOCK.


%% DO NOT CHANGE THIS PART.
%%
%% Here we define the steady state vZNues of the endogenous variables of
%% the model.
%%
NumberOfEndogenousVariables = M_.endo_nbr;                    % Number of endogenous variables.
ys = zeros(NumberOfEndogenousVariables,1);                    % Initialization of ys (steady state).
for i = 1:NumberOfEndogenousVariables                         % Loop...
  varname = deblank(M_.endo_names(i,:));                      %    Get the name of endogenous variable i.                     
  eval(['ys(' int2str(i) ') = ' varname ';']);                %    Get the steady state vZNue of this variable.
end                                                           % End of the loop.
%%