首页 > 解决方案 > 如何在 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]}

玛丽·A·马里恩

标签: plotwolfram-mathematica

解决方案


改变

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

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

推荐阅读