Mercurial > octave-nkf
diff scripts/ode/private/odepkg_event_handle.m @ 20586:b7ac1e94266e
maint: Further clean up of functions in ode/private dir.
* AbsRel_Norm.m, fuzzy_compare.m, integrate_adaptive.m, integrate_const.m,
integrate_n_steps.m, ode_struct_value_check.m, odepkg_event_handle.m,
odepkg_structure_check.m, runge_kutta_45_dorpri.m:
Place latest copyright first in file.
Use two spaces before beginning single-line comment.
Use parentheses around variable to be tested in switch stmt.
Use space between function name and opening parenthesis.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 05 Oct 2015 12:03:16 -0700 |
parents | eb9e2d187ed2 |
children |
line wrap: on
line diff
--- a/scripts/ode/private/odepkg_event_handle.m Mon Oct 05 11:59:18 2015 -0700 +++ b/scripts/ode/private/odepkg_event_handle.m Mon Oct 05 12:03:16 2015 -0700 @@ -84,7 +84,7 @@ vinpargs = {vevefun, vt, vy}; else vinpargs = {vevefun, vt, vy{1}, vy{2}}; - vy = vy{1}; # Delete cell element 2 + vy = vy{1}; # Delete cell element 2 endif if (nargin > 4) vinpargs = {vinpargs{:}, varargin{:}}; @@ -103,7 +103,7 @@ vinpargs = {vevefun, vt, vy}; else vinpargs = {vevefun, vt, vy{1}, vy{2}}; - vy = vy{1}; # Delete cell element 2 + vy = vy{1}; # Delete cell element 2 endif if (nargin > 4) vinpargs = {vinpargs{:}, varargin{:}}; @@ -115,8 +115,8 @@ ## Check if one or more signs of the event has changed vsignum = (sign (veveold) != sign (veve)); - if (any (vsignum)) # One or more values have changed - vindex = find (vsignum); # Get the index of the changed values + if (any (vsignum)) # One or more values have changed + vindex = find (vsignum); # Get the index of the changed values if (any (vdir(vindex) == 0)) ## Rising or falling (both are possible) @@ -132,8 +132,8 @@ ## Create new output values if a valid index has been found if (! isempty (vindex)) ## Change the persistent result cell array - vretcell{1} = any (vterm(vindex)); # Stop integration or not - vretcell{2}(vevecnt,1) = vindex(1,1); # Take first event found + vretcell{1} = any (vterm(vindex)); # Stop integration or not + vretcell{2}(vevecnt,1) = vindex(1,1); # Take first event found ## Calculate the time stamp when the event function returned 0 and ## calculate new values for the integration results, we do both by ## a linear interpolation