Hello,
I am trying to follow the Intro to DynamicalSystems.jl YouTube Video from the Official Julia programming Account: Intro to dynamical systems in Julia - YouTube
I want to plot the trajectories of a simple deterministic Dynamical System but always get an error while I try to plot the trajectories.
The Plotting error is: Cannot convert StateSpaceSet{2, Float64} to series data for plotting
While calling tr[:,1] I should get a vector but always get an error:
ERROR: MethodError: no method matching getindex(::Tuple{StateSpaceSet{2, Float64}, StepRange{Int64, Int64}}, ::Colon, ::Int64)
Somehow I can not work with these Datset types.
Code is below
## 1) Define function of System:
# Using a Static Vector because the System is small
h_eom(x,p, t) = SVector{2}(1.0 - p[1]*x[1]^2 + x[2], p[2]*x[1] )
## 2) State
state = zeros(2) # Does not matter if we use Vector of SVector for the state
## 3) Parameters
p = [1.4, 0.3] # p = [a,b] from the equations of motion
## 1-3) Are enough to make a DynamicalSystems
henon = DiscreteDynamicalSystem(h_eom, state, p )
##### Getting a trejectory
# trajectory(ds:DynamicalSystems, T [, u]; kwargs... )
##### Getting a trajectory
## Trajectory from initial condition:
tr = trajectory(henon, 10000)
##Trajectory from a different starting point:
tr2 = trajectory(henon, 10000 , 0.01rand(2))
## Plotting
figure(figsize=(6,4))
plot(tr[1][:], tr[2][:], lw=0.0, marker="o", ms=0.1, alpha=0.5)
plot(tr2[1][:], tr2[2][:], lw=0.0, marker="o", ms=0.1, alpha=0.5)
xlabel("x")
ylabel("y")