Effacer les filtres
Effacer les filtres

ODE solver event function problems

1 vue (au cours des 30 derniers jours)
tensorisation
tensorisation le 19 Jan 2016
Modifié(e) : tensorisation le 19 Jan 2016
say i have some function f(y) (where y is one of my function in the ode set that i am solving) and my event is f(y)=1. for the first time the event will happen, i want to terminate the integration so i can set new "initial conditions" at the terminating point, and then i want to continue to integrate all the way up to my desired span where the event may occur more times (but here i dont want to stop integration).
for this to happen the way i want i make 2 event function, 1 for before the 1st event occurs, and 1 for after the 1st event occur.
for the event function i set for before the 1st event occurs i set [value,isterminal,direction]=[f(y)-1,1,0] and for the event function after the 1st event occurs i set [value,isterminal,direction]=[f(y)-1,0,0]
now the main reason for me to use the even functions in the first place is that in my set of ode i have a function that looks like this:
function alpha=alpha(u)
if f(u)<=1
alpha=0;
else
alpha=alpha_parameter;
end
end
where alpha_parameter is some constant that i define before, and f is the same function that appears in the event function.
as you can see, this alpha function is not continuous at the point f=1 which causes discontinuities in the derivative of atleast one of my solution function in the ode, and that is exactly why im using the event function.
now here are a few things that im not sure about and may cause problems in my code:
1.) im not sure if using the event function in itself devides the integration span so that it gets pass the discontinuities, or the event function in itself only record the locations of the event points and really does nothing when it comes to dealing with the discontinuities?
2.) if, as i suspect, the event function in itself only records the location of the event points, i have to terminate at every single event point that may appear in my integration span and start integration again from the terminating point using y_0=y_event as my "initial conditions" at the new terminating point each time?
3.) wouldn't doing the process i described in 2.) would cause the integration to stop slightly before the event point, and then if i start integrating again using y_0=y_event right at the start of my integration i will encounter the discontinuous event point again, which will cause problems due to the discontinuity? if so, what is the proper method for dealing with the discontinuity?
4.)for my case, is there a simple way to account for all the discontinuous event points (without knowing in advance how many will there be) that may or may not appear in my intergration span, so that i will be able to properly get a solution despite the discontinuities?
thanks alot for anyone willing to help me out here.

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by