comparison scripts/ode/ode45.m @ 20580:25623ef2ff4f

doc: Rewrite docstrings for ode* family of functions. * scripts/ode/module.mk: Remove extra newline. * ode45.m, odeget.m, odeset.m: Rewrite docstrings. * AbsRel_Norm.m, fuzzy_compare.m, hermite_quartic_interpolation.m, integrate_adaptive.m, integrate_const.m, integrate_n_steps.m, kahan.m, ode_struct_value_check.m, odepkg_event_handle.m, odepkg_structure_check.m, runge_kutta_45_dorpri.m, starting_stepsize.m: Don't break @deftypefn lines. Wrap lines at 80 columns rather than 72.
author Rik <rik@octave.org>
date Sat, 03 Oct 2015 21:03:16 -0700
parents 3339c9bdfe6a
children e368ce72a844
comparison
equal deleted inserted replaced
20579:52ce821a52fd 20580:25623ef2ff4f
17 ## You should have received a copy of the GNU General Public License 17 ## You should have received a copy of the GNU General Public License
18 ## along with Octave; see the file COPYING. If not, see 18 ## along with Octave; see the file COPYING. If not, see
19 ## <http://www.gnu.org/licenses/>. 19 ## <http://www.gnu.org/licenses/>.
20 20
21 ## -*- texinfo -*- 21 ## -*- texinfo -*-
22 ## @deftypefn {Function File} {[@var{sol}] =} ode45 (@var{fun}, @var{slot}, @var{init}, [@var{opt}], [@var{par1}, @var{par2}, @dots{}]) 22 ## @deftypefn {Function File} {[@var{t}, @var{y}] =} ode45 (@var{fun}, @var{trange}, @var{init})
23 ## @deftypefnx {Function File} {[@var{t}, @var{y}, [@var{xe}, @var{ye}, @var{ie}]] =} ode45 (@var{fun}, @var{slot}, @var{init}, [@var{opt}], [@var{par1}, @var{par2}, @dots{}]) 23 ## @deftypefnx {Function File} {[@var{t}, @var{y}] =} ode45 (@var{fun}, @var{trange}, @var{init}, @var{opt})
24 ## 24 ## @deftypefnx {Function File} {[@var{t}, @var{y}] =} ode45 (@dots{}, @var{par1}, @var{par2}, @dots{})
25 ## This function file can be used to solve a set of non--stiff ordinary 25 ## @deftypefnx {Function File} {[@var{t}, @var{y}, @var{xe}, @var{ye}, @var{ie}] =} ode45 (@dots{})
26 ## differential equations (non--stiff ODEs) with the well known explicit 26 ## @deftypefnx {Function File} {@var{sol} =} ode45 (@var{fun}, @var{trange}, @var{init}, @dots{})
27 ## Dormand-Prince method of order 4. 27 ##
28 ## 28 ## Solve a set of non-stiff Ordinary Differential Equations (non-stiff ODEs)
29 ## This function can be called with two output arguments: @var{t} and @var{y}. 29 ## with the well known explicit Dormand-Prince method of order 4.
30 ## Variable @var{t} is a column vector and contains the time stamps, instead 30 ##
31 ## @var{y} is a matrix in which each column refers to a different unknown of 31 ## The first input argument must be a function handle or inline function that
32 ## the problem and the rows number is the same of @var{t} rows number so that each 32 ## defines the ODE: @code{y' = f(t,y)}. The function must accept two inputs
33 ## row of @var{y} contains the values of all unknowns at the time value contained 33 ## where the first is time @var{t} and the second is a column vector of
34 ## in the corresponding row in @var{t}. 34 ## unknowns @var{y}.
35 ## 35 ##
36 ## The first input argument must be a function_handle or an inline function that 36 ## @var{trange} specifies the time interval over which the ODE will be
37 ## defines the set of ODE: @code{y' = f(t,y)}. As described above, this function 37 ## evaluated. Usually, it is a two-element vector specifying the initial and
38 ## must take two input arguments, where the first is the time and the second 38 ## final times (@code{[tinit, tfinal]}). If there are more than two elements
39 ## the unknowns, and must have just one output argument. 39 ## then the solution will also be evaluated at these intermediate time
40 ## 40 ## instances unless the integrate function called is
41 ## The second input argument must contain time informations. Usually it should 41 ## @command{integrate_n_steps}. If there is only one time value, then
42 ## be a vector with at least two elements which define the initial and the final 42 ## @code{ode45} will raise an error unless the options structure has
43 ## time instants; if the elements are more than two, then the solution will be 43 ## non-empty fields named @var{"TimeStepNumber"} and @var{"TimeStepSize"}.
44 ## evaluated also at these intermediate time instants unless the integrate function 44 ## If the option @var{"TimeStepSize"} is not empty, then the stepper called
45 ## called is the @command{integrate_n_steps}. If there is only one time value, 45 ## will be @command{integrate_const}. If @var{"TimeStepNumber"} is also
46 ## then it will give an error unless the options structure has no empty fields 46 ## specified then the integrate function @command{integrate_n_steps} will be
47 ## named @var{"TimeStepNumber"} and @var{"TimeStepSize"}. If the option 47 ## used; otherwise, @command{integrate_adaptive} is used. For this last
48 ## @var{"TimeStepSize"} is not empty, then the stepper called will be 48 ## possibility the user can set the tolerance for the timestep computation by
49 ## @command{integrate_const}, if also @var{"TimeStepNumber"} is not empty it will 49 ## changing the option @var{"Tau"}, that has a default value of @math{1e-6}.
50 ## be called the integrate function @command{integrate_n_steps}, otherwise it will 50 ##
51 ## be called @command{integrate_adaptive}. For this last possibility the user can 51 ## The third input argument @var{init} contains the initial value for the
52 ## set the tolerance for the timestep computation by setting a value to the option 52 ## unknowns. If this is a row vector then the solution @var{y} will be a matrix
53 ## @var{"Tau"}, that as default value has @math{1.e-6}. 53 ## in which each column is the solution for the corresponding initial value
54 ## 54 ## in @var{init}.
55 ## The third input argument must contain the initial value for the unknown. 55 ##
56 ## If this is a vector then the solution @var{y} will be a matrix in which each 56 ## If present, the fourth input argument specifies options to the ODE solver.
57 ## column is the solution for the corresponding initial value in @var{init}. 57 ## It is a structure typically generated by @code{odeset}.
58 ## 58 ##
59 ## The fourth input argument is not mandatory and it should contain a structure 59 ## The function usually produces just two outputs. Variable @var{t} is a
60 ## with valid ODE fields. 60 ## column vector and contains the times where the solution was found. The
61 ## output @var{y} is a matrix in which each column refers to a different
62 ## unknown of the problem and each row corresponds to a time in @var{t}.
61 ## 63 ##
62 ## For example, solve an anonymous implementation of the Van der Pol equation 64 ## For example, solve an anonymous implementation of the Van der Pol equation
65 ##
63 ## @example 66 ## @example
67 ## @group
64 ## fvdp = @@(t,y) [y(2); (1 - y(1)^2) * y(2) - y(1)]; 68 ## fvdp = @@(t,y) [y(2); (1 - y(1)^2) * y(2) - y(1)];
65 ## [T,Y] = ode45 (fvdp, [0 20], [2 0]); 69 ## [T,Y] = ode45 (fvdp, [0 20], [2 0]);
70 ## @end group
66 ## @end example 71 ## @end example
72 ## @seealso{odeset, odeget}
67 ## @end deftypefn 73 ## @end deftypefn
68 ##
69 74
70 function [varargout] = ode45 (vfun, vslot, vinit, varargin) 75 function [varargout] = ode45 (vfun, vslot, vinit, varargin)
71 76
72 vorder = 5; % runge_kutta_45_dorpri uses local extrapolation 77 vorder = 5; % runge_kutta_45_dorpri uses local extrapolation
73 vsolver = "ode45"; 78 vsolver = "ode45";