Hi. I would like to generate 2 separate figures. These are shown below. Figure 1 shows the numerical solution, plus the actual solution. Figure 2 shows the (tiny) error. I can’t put all this on a single plot since the “solution error” is about 10^-8 x smaller than the solution. There is a similar posting (Plotting multiple figures using Plots,jl), But I have “plot” and “plot!” in figure 1.
using Plots
# figure 1
plot(sol, seriestype=:scatter, title = "Solution to the linear ODE",
xaxis = "Time (t)", yaxis = "u(t) (in μm)", label = "Numerical soln",mc=:red, ms=5)
plot!(t1, sol_act, label="Actual",lc=:black, lw=2)
# figure 2
plot(t1, err, title = "Solution Error",seriestype=:scatter, label="errors",mc=:green, ms=6)
Glad you find a working solution. I forgot to mention that reuse = false doesn’t work with the GR backend at the moment. That is why, this solution doesn’t work, since GR is the default backend.
Thanks very much. I am just getting into Julia. I have managed to get a numerical solution to a 2nd order nonlinear ODE problem (which bombed in Python).