How to Plot inside For Loop for Differential Equation

Does this work for you?

using Plots, LaTeXStrings, Plots.PlotMeasures
gr()

f(x) = 900 + exp(x / 2)

p = plot(f, 0, 10, xticks=false, xlims=(0, 10), ylims=(600, 1200),
    bottom_margin=10mm, label=L" 900 + ce^{t/2}", framestyle=:zerolines,
    legend=:outerright)

for i = 50:50:200
    g(x) = 900 + i * exp(x / 2)
    plot!(p, g, xticks=false, xlims=(0, 10), ylims=(600, 1200),
        bottom_margin=10mm, label="", framestyle=:zerolines,
        legend=:outerright)
end

display(p)
1 Like