The Parameter of ODE is not Updated When the EventCallback Function is Called
Afficher commentaires plus anciens
I was simulating ODEs which incorporate additional parameter (ydot = f(t,y,P)).
There is an event occurs in the simulation process and the event is processed with odeEvent function.
The eventCallback function is illustrated as follows:
function [stop,Ye,Pout] = impactEventCallback(te,ye,ie,Pin)
% ... parameter updating calculation
fprintf("parameter befor updating : %.5f After updating : %.5f \n",Pin.v,Pout.v); % output updating result
end
The simulation result is demonstrated as follows:
parameter befor updating : 0.10000 After updating : 0.37232
parameter befor updating : 0.10000 After updating : 0.08382
parameter befor updating : 0.10000 After updating : 0.06401
...
It seems that every time the impactEventCallback function is called, the parameter before updating (Pin) is not changed.
I suspect that the updated parameter Pout is not used by the governing equations ydot = f(t,y,P).
The expected result should be that the next time the value of Pin is the last time value of Pout.
Can anyone give some advices about how to fix this issue ?
Réponses (1)
Chuguang Pan
le 28 Déc 2024
Déplacé(e) : Walter Roberson
le 28 Déc 2024
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!