diff --git a/docs/src/tutorials/constraints.md b/docs/src/tutorials/constraints.md index 14b94758f..8ccdda3c2 100644 --- a/docs/src/tutorials/constraints.md +++ b/docs/src/tutorials/constraints.md @@ -35,8 +35,6 @@ Dxx = Differential(x)^2 _σ = 0.5 x_0 = -2.2 x_end = 2.2 -# Discretization -dx = 0.01 eq = Dx((α * x - β * x^3) * p(x)) ~ (_σ^2 / 2) * Dxx(p(x)) @@ -57,7 +55,7 @@ lb = [x_0] ub = [x_end] function norm_loss_function(phi, θ, p) function inner_f(x, θ) - dx * phi(x, θ) .- 1 + 0.01 * phi(x, θ) .- 1 end prob = IntegralProblem(inner_f, lb, ub, θ) norm2 = solve(prob, HCubatureJL(), reltol = 1e-8, abstol = 1e-8, maxiters = 10) @@ -98,7 +96,7 @@ using Plots C = 142.88418699042 #fitting param analytic_sol_func(x) = C * exp((1 / (2 * _σ^2)) * (2 * α * x^2 - β * x^4)) -xs = [infimum(d.domain):dx:supremum(d.domain) for d in domains][1] +xs = [infimum(d.domain):0.01:supremum(d.domain) for d in domains][1] u_real = [analytic_sol_func(x) for x in xs] u_predict = [first(phi(x, res.u)) for x in xs] diff --git a/docs/src/tutorials/param_estim.md b/docs/src/tutorials/param_estim.md index 0a5f40ace..29b6ca249 100644 --- a/docs/src/tutorials/param_estim.md +++ b/docs/src/tutorials/param_estim.md @@ -58,7 +58,7 @@ u0 = [1.0; 0.0; 0.0] tspan = (0.0, 1.0) prob = ODEProblem(lorenz!, u0, tspan) sol = solve(prob, Tsit5(), dt = 0.1) -ts = [infimum(d.domain):dt:supremum(d.domain) for d in domains][1] +ts = [infimum(d.domain):0.01:supremum(d.domain) for d in domains][1] function getData(sol) data = [] us = hcat(sol(ts).u...) @@ -130,7 +130,7 @@ And then finally some analysis by plotting. ```@example param_estim minimizers = [res.u.depvar[depvars[i]] for i in 1:3] -ts = [infimum(d.domain):(dt / 10):supremum(d.domain) for d in domains][1] +ts = [infimum(d.domain):(0.001):supremum(d.domain) for d in domains][1] u_predict = [[discretization.phi[i]([t], minimizers[i])[1] for t in ts] for i in 1:3] plot(sol) plot!(ts, u_predict, label = ["x(t)" "y(t)" "z(t)"])