using DifferentialEquations
f(u,p,t) = 1.01*u
u0 = 1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob, Tsit5(), reltol=1e-8, abstol=1e-8)
using Plots
plot(sol,linewidth=5,title="Solution to the linear ODE with a thick line",
xaxis="Time (t)",yaxis="u(t) (in μm)",label="My Thick Line!") # legend=false
plot!(sol.t, t->0.5*exp(1.01t),lw=3,ls=:dash,label="True Solution!")这是DifferentialEquations.jl文档中的一个示例代码,每当我尝试运行它时,我都会得到UndefVarError: plot!未定义
当执行更简单的版本时,会出现类似的错误。
using DifferentialEquations
f(u,p,t) = 1.01*u
u0 = 1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
println(prob)UndefVarError: ODEProblem未定义的
我运行状态,以下是我在Windows 10上运行的Julia1.5.1(今天第一次安装)的当前版本:
Atom v0.12.21
DifferentialEquations v6.15.0
IJulia v1.21.3
Juno v0.8.3发布于 2020-09-04 03:33:57
请你分享整个错误信息好吗?您应该查看第一个错误,这可能是由于没有添加包,并遵循该错误消息的步骤。看起来您从未添加过Plots.jl,所以using Plots应该失败了。
https://stackoverflow.com/questions/63733807
复制相似问题