It’s not quite clear what he wants. I supposed that he intend to illustrate that the solution stabilizes starting from a time t’>0, and wanted to plot that solution above the integration time of the general solution, i.e. xlims=(sol.t[1], sol.t[end]). But I’m not sure…
The question seems to be resolved, but just in case someone is in a similar situation and is looking for alternatives:
To deal with a transient time in some simulation, I usually use something like this:
# Define system of equation
function f(du, u, p, t)
du[1] = -u[1]
end
# Parameter for system (in this case there are none)
p = []
# Initial conditions
u0 = [1]
# Time points to integrate
times = 0:0.01:8
# Transient time
transient = 1
# Define ODE problem
prob = ODEProblem(
f, # system to integrate
u0, # initial conditions
(times[1], times[end] + transient), # time bounds to integrate in
p # parameters for the system
)
# Solve problem
sol = solve(
prob, # problem to solve for
saveat = times .+ transient # times to get an answer for, but shifted by the transient time
)
# Plot trajectories
plot(sol)
Someone, please feel free to correct me if this is an unnatural or inefficient way of doing things!