Ode45, Events error: SWITCH expression must be a scalar or a character vector
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I have this problem using "Events" option for ode45.
In the main I have:
Tol0 = 1e-13;
Tol1 = 1e-13;
options = odeset('Events', @myEvent, 'RelTol', Tol0, 'AbsTol', Tol1);
s0 = [1, 2, 3, 4, 5, 6];
tspan = [0 100];
[time,S] = ode45('Dyn', tspan, s0, options);
My event function is:
function [value, isterminal, direction] = myEvent(t,S)
value = S(2);
isterminal = 1;
direction = 0;
end
The error appearing in the command window is:
SWITCH expression must be a scalar or a character vector.
Error in odeevents (line 34)
switch lower(eventFcn)
Error in ode45 (line 137)
odeevents(odeIsFuncHandle,ode,t0,y0,options,varargin);
Error in Main (line 31)
[time,S] = ode45('Dyn', tspan, s0, options);
Could you help me?
Thank you.
3 commentaires
Réponses (1)
Walter Roberson
le 30 Nov 2023
I have seen this before when the person had a third-party version of lower in their MATLAB path. Please show
which -all lower
The interfering toolbox was something like EEGLab or SPM12 or something-or-other-8 (I forget the name)
2 commentaires
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!