[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59709] ode event handler function is incorrec
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1] |
Date: |
Thu, 17 Dec 2020 11:05:11 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?59709>
Summary: ode event handler function is incorrect when
direction variable is [-1, -1]
Project: GNU Octave
Submitted by: rik5
Submitted on: Thu 17 Dec 2020 08:05:09 AM PST
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: 6.1.0
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
This report originated as a Help topic on Discourse:
https://octave.discourse.group/t/incorrect-events-handling-by-ode45/539/6.
The necessary files to reproduce the bug are attached. Download all of them
and then run solve_myode.m.
The issue is in ode_event_handler.m
## Check if one or more signs of the event has changed
signum = (sign (evtold) != sign (evt));
if (any (signum)) # One or more values have changed
idx = find (signum); # Get the index of the changed values
if (any (dir(idx) == 0))
## Rising or falling (both are possible)
## Don't change anything, keep the index
elseif (any (dir(idx) == sign (evt(idx))))
## Detected rising or falling, need a new index
idx = find (dir == sign (evt));
else
## Found a zero crossing but must not be notified
idx = [];
endif
If none of the direction indicators are 0 (accept rising or falling edge) then
the elseif is executed and Octave can get the wrong index. This will happen
for direction indicators which are all positive ([1, 1, ...]) or all negative
([-1, -1, ...]) as in this example case.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Thu 17 Dec 2020 08:05:09 AM PST Name: myode.m Size: 47B By: rik5
<http://savannah.gnu.org/bugs/download.php?file_id=50497>
-------------------------------------------------------
Date: Thu 17 Dec 2020 08:05:09 AM PST Name: solve_myode.m Size: 1KiB By:
rik5
<http://savannah.gnu.org/bugs/download.php?file_id=50498>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59709>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1],
Rik <=
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1], Rik, 2020/12/17
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1], Rik, 2020/12/17
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1], Hg200, 2020/12/17
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1], Rik, 2020/12/17
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1], Hg200, 2020/12/17
- [Octave-bug-tracker] [bug #59709] ode event handler function is incorrect when direction variable is [-1, -1], Rik, 2020/12/17