how to find an rbc model's steady state in matlab

In order to find the steady state of an RBC model in Matlab, we need to solve a set of nonlinear equations. Specifically, we need to find the values of the endogenous variables that satisfy the model's dynamic equations and the market clearing conditions.

A common approach to solve this kind of problems is to use the built-in Matlab function fsolve, which implements a numerical solver for nonlinear equations. The general steps to find the steady state are as follows:

  1. Define the RBC model's dynamic equations and market clearing conditions as a function that takes the endogenous variables as input.

  2. Use fsolve to find the values of the endogenous variables that satisfy the function output. The initial guess for the endogenous variables can be set to any reasonable value.

Here's an example of how this process can be implemented:

main.m
% Define the RBC model's dynamic equations and market clearing conditions
function f = rbc_ss(x)
    % Parameters
    alpha = 0.33;
    beta = 0.95;
    delta = 0.1;
    sigma = 1;
    rho = 0.9;
    
    % Endogenous variables
    k = x(1);
    c = x(2);
    r = x(3);
    w = x(4);
    
    % Equations
    f(1) = r - alpha * k^(alpha - 1);
    f(2) = w - (1 - alpha) * k^alpha;
    f(3) = c - (1 - delta) * k - k^alpha * (1 - delta) + r * k;
    f(4) = beta * ((r - delta) * (1 - sigma) + 1) - 1;
end

% Solve for the steady state
x0 = [1, 1, 1, 1]; % initial guess
x_ss = fsolve(@rbc_ss, x0)
596 chars
26 lines

In this example, the RBC model consists of a production function, an Euler equation, and the market clearing conditions for capital and labor. The variables to solve for are capital (k), consumption (c), the interest rate (r), and the wage rate (w). The parameters of the model are set to some arbitrary values.

The rbc_ss function defines the equations of the model as a system of four nonlinear equations that must be satisfied at the steady state. fsolve is called with the @rbc_ss argument, indicating that it should solve for the zeros of the rbc_ss function. The initial guess for the steady state values is set with the x0 variable.

The solution is returned as the x_ss vector, which contains the steady state values for k, c, r, and w.

gistlibby LogSnag