Hysteresis in ODE solvers

I'm trying to solve a 2nd order ODE of form x'' = f(x) with a hysteretic component: After x reaches a peak I'd like to add another function, g(x), to the equation such that x'' = f(x) + g(x, xpeak), where xpeak is the most recent local maxima of x. I'd then like to remove g(x, xpeak) once x reaches a minima.
I realize an if loop checking the value of x' would allow me to know when to add and remove g(x), but I can't assign a value for xpeak within the framework of the ODE function; as far as I can tell, previous x values cannot be accessed by the ODE function while the ODE solver is running, meaning I'll have no way of knowing whether or not I hit a peak until the solver has finished running. Assuming I could identify xpeak and save it to a file or separate workspace somewhere, the ODE function could then load xpeak when the function is called by the ODE solver. But the quesiton remains; how do I identify xpeak if I don't know anything about previous x values?

답변 (0개)

카테고리

질문:

2017년 9월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by