In order to compare with different parameter,can i use StreamPlot plot them in a line, for example:

$$\dot{x} = Ax$$

When $A = [-1,0;0,-2]$, i can use code as follows,

linearsys = 
  StreamPlot[{-x, -2 y}, {x, -14, 14}, {y, -14, 14}, 
   StreamColorFunction -> "Rainbow", StreamPoints -> 24, 
   StreamScale -> 0.15, PerformanceGoal -> "Quality"];
Manipulate[
 Show[linearsys, 
  ParametricPlot[
   Evaluate[
    First[{x[t], y[t]} /. 
      NDSolve[{x'[t] == -x[t], y'[t] == -2 y[t], 
        Thread[{x[0], y[0]} == point]}, {x, y}, {t, 0, T}]]], {t, 0, 
    T}, PlotStyle -> Red]], {{T, 0.1}, 0.1, 10}, {{point, {4, 4}}, 
  Locator}, SaveDefinitions -> True]

If $A = [\lambda_1,0;0,\lambda_2],~(\lambda_1,\lambda_2)=(1,2), ~(\lambda_1,\lambda_2)=(1,1),)$, how can i use Table to plot StreamPlot and Manipulate respectively?

up vote 2 down vote accepted

Let's rewrite your code to directly incorporate the matrix $a$:

a = {{-1, 0}, {0, -2}};
linearsys = 
  StreamPlot[a.{x, y}, {x, -14, 14}, {y, -14, 14}, 
   StreamColorFunction -> "Rainbow", StreamPoints -> 24, 
   StreamScale -> 0.15, PerformanceGoal -> "Quality"];
Manipulate[
 Show[linearsys, ParametricPlot[Evaluate[First[{x[t], y[t]} /. 
      NDSolve[{{x'[t], y'[t]} == a.{x[t], y[t]}, 
        Thread[{x[0], y[0]} == point]}, {x, y}, {t, 0, T}]]], {t, 0, T}, 
        PlotStyle -> Red]], {{T, 0.1}, 0.1, 10}, {{point, {4, 4}}, Locator}]

Now you can change the $a$ matrix at the top and it will plot the flow lines for that $a$ matrix.

BTW -- Ben, where did you get that code from? It is always good form to reference the source of code when it is not original.

  • yeah,i forget the original,because i have make some change according mma official document.Thank you, i will try to find it. – Ben Nov 9 at 14:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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