
% Provides steady state values to dynamic problem solver
function [ys,check] = dyn_main_steadystate(ys,exe) %#ok<INUSD>

  global M_ 
  
  par = cell2struct(...
        num2cell(M_.params),...
        cellstr(M_.param_names)...
        );

  % Initial guess
  val = [0.7 .34 0.19 0.12 -0.4]';
  
  options = optimset('fsolve');
  options = optimset(options,'Display','off');
  X  = fsolve(@(x) stst(x,par), val, options);
  [xxx,out] = stst(X,par); %#ok<*ASGLU>

  
     c = X(1);
     n = X(2);
     i = X(3);
     s = X(4);
    xi = X(5);
     z = out.z;
   eta = out.eta;
     r = out.r;
     R = out.R;
     p = out.p;
     P = out.P;
     x = out.x;
     K = out.K;
   gdp = out.gdp;
    ex = out.ex;
  cpct = out.cpct;
  ipct = out.ipct;
  xpct = out.xpct;
   tot = out.tot;
   rer = out.rer;
    nx = out.nx;
    RC = out.RC;

  myss = [r c n i s K R p P x xi z eta gdp ex cpct ipct xpct tot rer nx RC];
 
  ys = [myss myss]';

  check = 0;

end

