0
$\begingroup$

I'm trying to visualize the phase diagram for a multidimensional system of differential equations, but projected down onto only 2D phase planes.

I've tried using the Lorenz system as a simpler case because it's in 3 variables, but I can't get the streamplot to work.

I setup the system as

 lorenz[σ_, r_, b_, x0_, y0_, z0_] := {
  x'[t] == σ*(y[t] - x[t]),
  y'[t] == r*x[t] - y[t] - x[t]*z[t],
  z'[t] == x[t]*y[t] - b*z[t],
  x[0] == x0,
  y[0] == y0,
  z[0] == z0
  }

followed by

sol= NDSolve[lorenz[10, 28, 8/3, 0.1, 0.1, 0], {x[t], y[t], z[t]}, {t, 0, 30}]
ParametricPlot[Evaluate[{x[t], y[t]} /. sol], {t, 0, 30}]

And that works to plot a specific trajectoy in 2D space. But what I want is a streamplot in the xy-plane.

I tried

lorenzstream[σ_, r_, b_] := {
  x' == σ*(y - x),
  y' == r*x - y - x*z,
  z' == x*y - b*z
  }

StreamPlot[lorenzstream[10, 28, 8/3][[{1, 2}, 2]], {x, -20, 20}, {y, -20, 20}]

It did not seem to work. Any help appreciated.

$\endgroup$
  • $\begingroup$ reference.wolfram.com/language/ref/ParametricPlot3D.html this can be helpful for 3D phase diagrams. $\endgroup$ – optimal control Jun 8 '17 at 15:42
  • $\begingroup$ What about for 2D phase diagrams? I want to visualize the x-y plane, but because y has some dependence on z, it's proving tricky. I'd like to visualize everything projected onto x-y, without just setting z to be 0. $\endgroup$ – John Jun 8 '17 at 15:47
  • $\begingroup$ Something like this? ContourPlot3D[{10 (-x + y), 28 x - y - x z, x y - (8 z)/3}, {x, -2, 2}, {y, -2, 2}, {z, -3, 3}, ViewPoint -> Top] $\endgroup$ – zhk Jun 8 '17 at 16:01
1
$\begingroup$

Your approach is very close. You only need to substitute z/.->0 for it to work.

lorenzstream[σ_, r_, b_] := {x' == σ*(y - x), y' == r*x - y - x*z, z' == x*y - b*z}

StreamPlot[
  lorenzstream[10, 28, 8/3][[{1, 2}, 2]] /. z -> 0, {x, -20, 20}, {y, -20, 20}]

Mathematica graphics

EDIT:

I see now that you say in a comment that you don't want to just set z to 0. In that case, it's not clear what you want plotted. Sorry!

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.