如何在Mathematica中向Vector Plot添加水平线(平衡)

时间:2018-06-09 03:46:29

标签: plot wolfram-mathematica

y'= 3-2y的平衡解是在y = 3/2,并且我想将线y = 3/2添加到使用VectorPlot函数绘制的方向场。怎么做?

下面的附加代码可以做到。

points = {{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 
    2}, {2, 2}};

datplot = 
  VectorPlot[{1, 3 - 2 y}, {x, 0, 2}, {y, 0, 2}, 
   VectorPoints -> points, VectorScale -> {Automatic, Automatic, None},
   Epilog -> {Red, PointSize[Medium], Point[points]}];

fitplot = Plot[y = 3/2, {y, 0, 2}];
{Show[datplot, fitplot]}

Mary A. Marion

2 个答案:

答案 0 :(得分:2)

更改

Epilog -> {Red, PointSize[Medium], Point[points]}

Epilog -> {Red, PointSize[Medium], Point[points], Line[{{0,3/2},{2,3/2}}]}

答案 1 :(得分:0)

以下代码将计算解决方案*:

points = {{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1},
    {0, 2}, {1,2}, {2, 2}};

datplot = 
  VectorPlot[{1, 3 - 2 y}, {x, 0, 2}, {y, 0, 2}, 
  VectorPoints -> points, VectorScale -> {Automatic, Automatic, None},
  Epilog -> {Red, PointSize[Medium], Point[points], 
    Line[{{0, 3/2}, {2, 3/2}}]}]
  • 请参阅上面的Bill的输入。