%Normalize all variables to efficiency-units x(t)= X(t)/A(t)*L(t)

y=k.^alpha;
kdot= s*y-(delta+g+n)*k;
L=(1+n);                            % population growth
A=(1+g);                            % technological growth

%% solves for the steady-state capital stock in the Solow Model
% parametrize the model parameters
alpha=0.36;     % output elasticity of capital/capital income share
n=0.0;          % population growth
g=0.01;         % economic (production) growth
s=0.36;         % savings rate
delta=0.075;    % depreciation rate 

% solve for the root of kdot
k0 = 5; % inital guess
options = optimset('disp','iter'); % display iterations
kss = fsolve(kdot,k0,options);

% Steady state (variables per unit of effective labor
kss=(s/(delta+g+n))^(1/(1-alpha));   % stock of physical capital
yss=(kss^alpha);   % output
css=(1-s)*yss;     % cosumption  
iss=s*yss;         % investment


%Chebyshev nodes
syms k
chebyshevT([0, 1, 2, 3, 4], kdot)

syms k y
fplot(chebyshevT(0:4,kdot))
axis([-1.5 1.5 -2 2])
grid on

ylabel('T_n(k)')
legend('T_0(k)','T_1(k)','T_2(k)','T_3(k)','T_4(k)','Location','Best')
title('Chebyshev polynomials of the first kind')





