So I have very little experience in Mathematica but would like to learn how to plot. I have seen a few threads on this for $2\times 2$ systems but not for $3\times 3$.

So I'm trying to plot the phase portrait of the solution to the following equation:


To make matters easier, I found a general solution:

$$\begin{bmatrix}x_1\\x_2\\x_3\end{bmatrix}=c_1e^{2t}\begin{bmatrix}1\\0\\-1\end{bmatrix}+c_2e^{(2-\sqrt2)t}\begin{bmatrix}1\\-\sqrt2\\1\end{bmatrix}+c_3e^{(2+\sqrt 2)t}\begin{bmatrix}1\\\sqrt2\\1\end{bmatrix}$$

I considered $c_1=c_2=c_3=1$ and tried to plot a solution using the following with ParametricPlot3D:

ParametricPlot3D[{ E^(-2 u) + E^(-2 u + u Sqrt[2]) +
   E^(-2 u - u Sqrt[2]), 
  Sqrt[2] E^(-2 u + u Sqrt[2]) - 
   Sqrt[2] E^(-2 u - u Sqrt[2]), -E^(-2 u) + E^(-2 u + u Sqrt[2]) - 
   E^(-2 u - u Sqrt[2])}, {u, -1, 10}, PlotTheme -> "Marketing"]

I get a nice solution curve based on a single initial condition, but is there a nice way to plot many general solutions together?


1 Answer 1


Here one way to plot many solutions for different C1, C[2], C[3].

dsol = DSolve[
         Thread[{x1'[t], x2'[t], 
                 x3'[t]} == {{-2, 1, 0}, {1, -2, 1}, {0, 1, -2}}.{x1[t], x2[t], 
                 x3[t]}], {x1, x2, x3}, t] // FullSimplify;

Since I work with MMA 8.0, I had to construct my own PlotLegend.

   Evaluate[({x1[t], x2[t], x3[t]} /. First@dsol) /. 
 tab = Flatten[
   Table[Thread[{C[1], C[2], C[3]} -> {i, j, k}], {i, -1, 
     1}, {j, -1, 1}, {k, -1, 1}], 2]]], {t, -1, 10}, 
  PlotStyle -> 
  Table[Hue[.8 (i - 1)/Length[tab]], {i, 1, Length[tab]}], 
  ImageSize -> 500], 
  Table[Graphics[{Hue[.8 (i - 1)/Length[tab]], 
Text[{C[1], C[2], C[3]} /. tab[[i]]]}, ImageSize -> 45], {i, 1, 

enter image description here

  • $\begingroup$ Thank you very much! $\endgroup$ Nov 21, 2017 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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