Teaching examples for three direct methods for solving optimal control problems, namely single shooting, single step, and pseudospectral.
- Download the project files
- Run INSTALL_Direct_Method_Examples.m in the MATLAB Command Window (automatically adds project files to your MATLAB path, downloads the required files, and opens an example)
INSTALL_Direct_Method_Examples
- See Run_All_Examples.m to run all the examples or the individual examples in
/src
Run_All_Examples
See INSTALL_Direct_Method_Examples.m for more information
- MATLAB File Exchange Submission IDs (51104, 65434)
The main methods should work on version R2014b or newer. Method_DTQPProject.m requires version R2016a or newer. Some of the plot decorations require newer versions that support structure properties in figures. The Optimization Toolbox is required.
This is the optimal control problem used in the examples. The problem formulation is:
The optimal control solution when \ell
is between 0 and 1/6 is:
Please see the following files that calculate the optimal states and control. See pages 120–123 of A. E. Bryson and Y.-C. Ho, Applied Optimal Control, revised printing ed. Taylor & Francis, 1975 for more details on this problem.