%This function defines a set of Euler equation for benchmark model
%log utility and no aggregate shocks.  Written by Philip Shaw,
%Fordham University, 2022.  Use at your own risk.
function[fx]=eulereq(x)
k=length(x); %length of unknown sequence of capital excluding
%the terminal value and starting value
global alpha beta frac
T=k+2;%time series for capital
KT=(alpha*beta).^(1./(1-alpha)); %steady state capital
k0=frac*KT; %starting capital stock 
K=[k0 x KT]; %combining starting value for capital, guess for  
%sequence of capital, and terminal value 
fx=1./(K(1:T-2).^alpha-K(2:T-1))-((beta.*alpha.*K(2:T-1).^(alpha-1))./(K(2:T-1).^alpha-K(3:T)));
fx=fx';