Filter löschen
Filter löschen

an ode where numerical method fails in matlab

1 Ansicht (letzte 30 Tage)
Can
Can am 13 Dez. 2014
Kommentiert: Can am 14 Dez. 2014
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?

Akzeptierte Antwort

Roger Stafford
Roger Stafford am 13 Dez. 2014
Bearbeitet: Roger Stafford am 13 Dez. 2014
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 Kommentare
Star Strider
Star Strider am 14 Dez. 2014
I appreciate the clear, concise discussion.
Can
Can am 14 Dez. 2014
thanks Roger Stafford, i'll look into it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by