# How to analyze the solution?

Hello everyone, I recently switched to julia from python and ran into a problem.
I solve a parameterized system:

``````Γ(x, λ, Θ) = 1 / (1 + exp(-λ*(x - Θ)))

function parametrized_2hr!(du, u, p, t)
a = p; b = p; c = p; d = p; xr = p; r = p; s = p; I = p; vs = p; λ = p; Θ = p;
k1 = p; k2 = p; k = p
du = u+b*u^2-a*u^3-u+I-k1*(u-vs)*Γ(u, λ, Θ)+k*(u-u)
du = c-d*u^2-u
du = r*(s*(u-xr)-u)
du = u+b*u^2-a*u^3-u+I-k2*(u-vs)Γ(u, λ, Θ)+k*(u-u)
du = c-d*u^2-u
du = r*(s*(u-xr)-u)
end

u0 = [-1.5, 0.0, 0.0, -1.5, 0.0, 0.0]
tspan = (0.0, 100.0)
p = [1.0, 3.0, 1.0, 5.0, -1.6, 0.01, 5.0, 4.0, 2.0, 10.0, -0.25, -0.17, -0.17, 0.0]
prob = ODEProblem(parametrized_2hr!,u0,tspan,p)
sol = solve(prob, reltol=1e-6)
``````

I read this documentation but still don’t understand how can I get an array for each variable: t, u1, u2, u3, u4, u5, u6?

For example, I write:

``````sizeof(sol.t)
``````

and I get 4776. But when I try to access the element:

``````sol.t
``````

I get the error:

``````BoundsError: attempt to access 597-element Vector{Float64} at index 
``````

Can you please explain what I am doing wrong and how to process the output correctly? For example, if I need to take the variable u1 and discard the first few values, and then find the local maxima.

`sizeof` is the wrong function. You want `length`. (you can query the help with `?sizeof`)

`[uu for uu in sol.u]` should give you the u1 vector (there are probably better ways). Then `findmax`.

1 Like