필터 지우기
필터 지우기

Solvind ODE with sudden change od dy/dt function

조회 수: 3 (최근 30일)
Antonio
Antonio 2012년 5월 21일
Hi all, I have a problem. I am trying to solve an ODE with ode45, but the dy/dt function has to change abruptly at a certain time t_intermediate. How do you treat this problem? If I try to use two solver and pass to the second the last solution of the first one the solution seems not to be correct.
Is there a way to manage this?
Thanks!
  댓글 수: 1
Teja Muppirala
Teja Muppirala 2012년 5월 21일
Just as another suggestion, are you also familiar with Simulink? It is my experience that Simulink out-of-the-box can generally handle these sorts of problems easier than MATLAB.
But if you want to do it with ODE45, I think Jan has the right idea.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2012년 5월 21일
ODE45 requires a smooth function. Discontinuos changes of dy/dt let ODE45 reduce the stepsize until the rounding error exceeds the error caused by the jump. Finally the accumulated rounding errors will dominate the result.
Therefore you have to integrate from t_0 to t_intermediate and use the intermediate results as initial values of the integration from t_intermediate to t_end using the modified function.
It would be nice if the event functions are powerful enough to trigger such a change of the parameters, but they aren't.
  댓글 수: 2
Antonio
Antonio 2012년 5월 21일
Yes, I am already doing what you suggest, but this seems to give errors.
E.g. a trivial example
computing the evolution for a (time dependent) function for a time T, or computing it into two pieces T/2, T/2, with the same function, passing the last solution of the first system to the second one, seems to give two different outputs.
Antonio
Antonio 2012년 5월 21일
I am trying to increase the 'InitialStep' value, but this seems to give no better result.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by