an ode where numerical method fails in matlab

1 次查看(过去 30 天)
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

更多回答(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