In this article, we develop a simple mathematical GNU Octave/MATLAB code that
is easy to modify for the simulation of mathematical models governed by
fractional-order differential equations, and for the resolution of
fractional-order optimal control problems through Pontryagin's maximum
principle (indirect approach to optimal control). For this purpose, a
fractional-order model for the respiratory syncytial virus (RSV) infection is
considered. The model is an improvement of one first proposed by the authors in
[Chaos Solitons Fractals 117 (2018), 142--149]. The initial value problem
associated with the RSV infection fractional model is numerically solved using
Garrapa's fde12 solver and two simple methods coded here in Octave/MATLAB: the
fractional forward {Euler's} method and the predict-evaluate-correct-evaluate
(PECE) method of Adams--Bashforth--Moulton. A fractional optimal control
problem is then formulated having treatment as the control. The fractional
Pontryagin maximum principle is used to characterize the fractional optimal
control and the extremals of the problem are determined numerically through the
implementation of the forward-backward PECE method. The implemented algorithms
are available on GitHub and, at the end of the paper, in appendixes, both for
the uncontrolled initial value problem as well as for the fractional optimal
control problem, using the free GNU Octave computing software and assuring
compatibility with MATLAB. The developed Octave/Matlab code is available at [https://github.com/SilverioRosa/numres-focp]This research was funded by The Portuguese Foundation for Science and Technology (FCT—Fundação para a Ciência e a Tecnologia), grants number UIDB/50008/2020 (S.R.) and UIDB/04106/2020 (D.F.M.T.).publishe