%                      Steady State Finder 
% Housekeeping
clear; clc;close all;
% ----  ----  ----  ----  Set Parameters.  ----  ----  ----  ----   

alpha=.33;      beta=.99;       delta=.025;         theta=8;        sigma=1.2; 
phi=.9;          psi=11;         psiw=15;          rhoz=.95;       rho=.55; 
rhow=0.75; inflhat=(1.05^(1/4)); rhoir=0.6;        zetapi=1.5;     zetay=0.125; 
phiinv=0.3;

% Guess the Steady State
%  [ y   c  h   k  w rk inv ps sp1 sp2   r  mc  vp   mu  ut    g
%    1   2  3   4  5  6   7  8   9  10  11  12  13   14  15   16    
x0=[1.2 .9 .3  10  2 .03 .2  1   1   1 .01  .9   1    1   1   .2];
   
% set options on fsolve %
options = optimset('maxiter',10e+9999999999,'tolfun',10e-20,'tolx',100e-99);  

[ss, fval, exitflag, output] = ...
  fsolve(@(x) sist_nm04(x,alpha,beta,delta,theta,sigma,phi,psi,psiw,rhoz,rho,rhow,inflhat), x0, options ) ;
    
ss1=ss'; clear ss; ss = ss1; clear ss1 n; 

VarNames=["y";"c"; "h";"k";"w";
         "rk";"inv";"ps";"sp1";"sp2";
         "r";"mc";"vp";"mu";"ut";
         "g"];

ModEq = table([1:length(ss)]',VarNames,round(ss,4));
disp(ModEq); 

%  ----  ----  ----  ----     ----  ----  ----  ----  ----  ----  ----  ----


parms=[alpha; beta; delta; theta; sigma; 
        phi;   psi;   psiw;   rhoz;   rho;
       rhow;  inflhat; rhoir; zetapi; zetay;phiinv];


