Sketching Phase Portrait in Julia

Dear All,

I watch this on youtube tutorial and wonder can Julia plot phase portrait from a matrix?

Capture d’écran_2022-10-08_21-17-07

I also try the LinearAlgebra and why does the eigenvectors different from the tutorial?

this is my code:

using LinearAlgebra
A = [4 0;
     2 -1]

eigvals(A)

eigvecs(A)

thanks all

Because they are normalized.

can Julia plot phase portrait from a matrix?

Maybe this discussion: Plotting a phase portrait of a differential equation - #6 by airpmb can provide some inspiration.

1 Like

take a look at:

Your code is not working with my CairoMakie and Makie

      Status `~/LasthrimProjection/JupyterLab/DifferentialEquations/Project.toml`
  [13f3f980] CairoMakie v0.8.13
  [5c1252a2] GeometryBasics v0.4.4
  [ee78f7c6] Makie v0.17.13
  [eacbb407] Meshes v0.25.1
  [91a5bcdd] Plots v1.33.0

weird that you don’t get the point type right. Try

using CairoMakie

odeSol(x, y) = CairoMakie.Point2f(-x, 2y) # x'(t) = -x, y'(t) = 2y
fig = Figure(resolution = (600, 400))
ax = Axis(fig[1, 1], xlabel = "x", ylabel = "y", backgroundcolor = :black)
streamplot!(ax, odeSol, -2 .. 4, -2 .. 2, colormap = Reverse(:plasma),
    gridsize = (32, 32), arrow_size = 10)
fig

It is still not working with the same errors.

Is something else exporting Point2f too? Try Makie.Point2f