Differential Equations with MATLAB Chapter 8
Contents
Using ode45 to find a vertical asymptote
We look at the equation
What happens when we look for an exact solution?
syms x y = dsolve('Dy = x + y^2, y(0)=1', 'x'); pretty(y)
airy(1, -x) #1 airy(3, -x) - -------------- #2 ---------------------------- airy(0, -x) #1 airy(2, -x) - -------------- #2 where 2/3 / 2 \2 #1 == 2 pi 3 - 3 sqrt(3) gamma| - | \ 3 / 1/6 / 2 \2 #2 == 2 pi 3 + 3 gamma| - | \ 3 /
The solution invoves two types of Airy functions. It isn't very easy to see what it means. What happens when we plot the numeric solution obtained using ode45?
f = @(x,y) x+y^2; [t,ya] = ode45(f,[0,1],1); plot(t,ya)
Warning: Failure at t=9.305611e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t.

It has a vertical asymptote between 0.9 and 0.95. We'll plot it on some smaller intervals.
[t,ya] = ode45(f,[0,0.9],1); plot(t,ya)

[t,ya] = ode45(f,[0,0.95],1); plot(t,ya)
Warning: Failure at t=9.305618e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t.

[t,ya] = ode45(f,[0,0.93],1); plot(t,ya)

[t,ya] = ode45(f,[0,0.94],1); plot(t,ya)
Warning: Failure at t=9.305485e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t.

The asymptote is at about t=0.93. You can zoom in to get a better idea.