%------------------------------------------------------------------ % This script shows how to solve the RBC model by Taylor projection %------------------------------------------------------------------ clear,clc %----------------------------------------- % Define symbolic variables and parameters %----------------------------------------- syms k kp c cp z zp epsp real syms BETA GAMMA ALPHA RHO DELTA SIGMA real %------------------------------------------------- % Function f (Euler condition) in a unit-free form %------------------------------------------------- f_fun=BETA*(c/cp)^GAMMA*(ALPHA*exp(zp)*kp^(ALPHA-1)+1-DELTA)-1; %------------------------------------------------------- % Function Phi (law of motion of capital and technology) %------------------------------------------------------- Phi_fun=[exp(z)*k^ALPHA+(1-DELTA)*k-c; RHO*z+SIGMA*epsp]; %-------------------------- % Vector of state variables %-------------------------- x=[k,z]; % current period xp=[kp,zp]; % future period %---------------------------- % Vector of control variables %---------------------------- y=[c]; % current period yp=[cp]; % future period %----------------- % Vector of shocks %----------------- shocks=[epsp]; %--------------------- % Vector of parameters %--------------------- symparams=[BETA,GAMMA,ALPHA,RHO,DELTA,SIGMA]; %-------------------- % Approximation order %-------------------- order=4; % fourth order is the maximum possible %---------------- % Call prepare_tp %---------------- model=prepare_tp(f_fun,Phi_fun,yp,y,xp,x,shocks,symparams,order); %----------- % Save model %----------- save('model') % you will need this later