Hello guys. I’m having trouble adapting a Matlab code that resolves a second-order ODE to the Julia equivalent.
This is the code in Matlab. It plots a graph with 3 curves:
syms y(x);
dy = diff(y);
edo = diff(y,x,2) == -0.1 * dy - 0.8 * y;
Bound_1 = y(0) == 5e-3;
Bound_2 = dy(0) == 0;
conds = [Bound_1 Bound_2];
t = [0, 30];
ySol(x) = dsolve(edo, conds);
figure(1)
fplot(ySol, t)
hold on
fplot(diff(ySol), t)
fplot(diff(ySol,2), t)
hold off
This is my equivalent Julia version. However, the resulting graph has only two curves.
f2(du, u, p, t) = -0.1du - 0.8u
u₀ = 5e-3
du₀ = 0.0
t = (0.0, 30.0)
prob = SecondOrderODEProblem(f2, du₀, u₀, t)
sol = solve(prob)
plot(sol)
How do I make the u''
curve appear in the graph generated by the julia?