an ode where numerical method fails in matlab

조회 수: 1 (최근 30일)
Can
Can 2014년 12월 13일
댓글: Can 2014년 12월 14일
hello, consider this ode:
syms t
y=dsolve('Dy=sqrt(1-y^2)','y(0)=1/sqrt(2)',t)
and the result is
y = sin(pi/4 + t)
when i try to use numerical methods (like euler, runge kutta, adams bashforth or built in ode solvers in matlab) and plotting it, i get this warning message:
Warning: Imaginary parts of complex X and/or Y arguments ignored
and because y starts to get imaginary values and matlab ignores imaginary parts, resultant points starts to diverge after t=pi/4. is there any way to overcome this problem?

채택된 답변

Roger Stafford
Roger Stafford 2014년 12월 13일
편집: Roger Stafford 2014년 12월 13일
When y nears 1, your differential equation system becomes what is known as 'stiff'. Even though the ideal solution is a perfectly smooth and regular function, the sizes of steps required in solving the corresponding differential equation system numerically become increasingly small. Look at it this way. When y attains a value of one, the differential equation dictates that the derivative dy/dt should be zero there. What is to prevent it from remaining fixed at y = 1 from that point on, or wandering off in any of a number of different directions? It is clearly a point of instability as far as the differential equation is concerned. This situation is not caused by the complex values you are seeing but lies in the very nature of the differential equation at this point. Read about this phenomenon at:
http://en.wikipedia.org/wiki/Stiff_equation
  댓글 수: 2
Star Strider
Star Strider 2014년 12월 14일
I appreciate the clear, concise discussion.
Can
Can 2014년 12월 14일
thanks Roger Stafford, i'll look into it.

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

추가 답변 (0개)

카테고리

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