Many economic and financial models, such as those for resource allocation or optimal growth, involve systems of differential equations with no explicit analytical solution. Solving these systems numerically and visualizing results are important tasks for economists and other financial analysts.
Using the fundamental Ramsey-Cass-Koopmans (RCK) model as an example, this code, along with the corresponding technical article, describes two workflows for creating, simulating, and visualizing a system of ordinary differential equations (ODEs). One approach is based on MATLAB®, the other on Simulink®. The MATLAB approach uses programming techniques familiar to financial professionals who work in a technical computing environment. The Simulink approach offers a visual modeling environment and graphical representation of the system.
The examples are provided as a MATLAB toolbox.
- Download the toolbox installer (the
RCK.mltbxfile) from theReleasessection on GitHub. - Double-click on the
RCK.mltbxfile to install the toolbox. - Open the main script:
>> edit createRCKModel - The example files are the live scripts within the project.
createRCKModel: This example shows how to define and solve the Ramsey-Cass-Koopmans model using MATLAB.createRCKModelTimeElim: This example shows how to define and solve the Ramsey-Cass-Koopmans model using MATLAB and the time elimination method to solve the system of ODEs.defineRCMParams: This example contains the parameter definitions used in the Ramsey-Cass-Koopmans model. The parameters are stored in a structure for later reuse.parallelRCKMATLAB: This example shows how to simulate the MATLAB version of the Ramsey-Cass-Koopmans model using parallel computing constructs to speed up the simulation process.parallelRCKSimulink: This example shows how to simulate the Simulink version of the Ramsey-Cass-Koopmans model using parallel computing constructs to speed up the simulation process.plotPhasePortrait: This example shows how to visualize the 2D phase plane corresponding to the system of ODEs defined by the Ramsey-Cass-Koopmans model.plotRCKSimulink: This example shows how to simulate the Simulink version of the Ramsey-Cass-Koopmans model.
MathWorks® Product Requirements
This example requires MATLAB R2025a or a later release.
The licenses for this entry are available in the license.txt and license_ds2nfu.txt files in this GitHub repository.
Copyright 2016-2026 The MathWorks, Inc.
