使用 gnuplot 的向量场
如何绘制矢量场,其中每个点 (x, y) 的方向由 tangent(alpha) = f(x, y)
给出?
How do I plot a vector field, where the direction at each point (x, y) is given by tangent(alpha) = f(x, y)
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,gnuplot 只能在从文件读取数据时绘制向量场。您的文件必须有 4 列,x、y、deltax 和 delta y,然后 gnuplot 将为文件中的每一行绘制从 (x,y) 到 (x+deltax, y+deltay) 的向量
:不坚持使用 gnuplot,还有其他工具可以更好或至少更容易地做到这一点。我个人使用 asymptote。 此处有一个在渐近线中绘制的矢量场示例。
As far as I can tell, gnuplot can only plot vector fields when reading data from a file. Your file will have to have 4 columns, x, y, deltax and delta y, and gnuplot will then plot a vector from (x,y) to (x+deltax, y+deltay) for each line in the file:
If you are not insisting on using gnuplot, there are other tools that can to this better or at least easier. I personally use asymptote. There is an example of a vectorfield plotted in asymptote here.
看来这个问题/答案有点旧了,因为我相信 gnuplot 在最新版本中发生了一些变化,所以可能应该更新答案。
我在这里找到了一个很好且紧凑的解决方案:
http://gnuplot.10905.n7.nabble.com/Vector-Fields -td3627.html
为了方便起见,我将报告它:
这里,最初的问题是如何绘制矢量场
F(x,y) =
。诀窍在于绘图“++”,它是一个特殊的文件名,允许使用
using
说明符中的函数。因此,正如 @Jan 在他的回答中所说,gnuplot 需要数据文件中的 4 个字段来绘制矢量场,但这里的字段是合成的并由两个函数生成。
使用已定义函数的等效公式可以是:
有关更多详细信息,请参阅
helpspecial-filenames
。HIH
It seems this question/answer is a bit old, and since I believe that gnuplot is changed a bit in the latest versions, probably the answer should be updated.
I found a nice and compact solution here, by thse:
http://gnuplot.10905.n7.nabble.com/Vector-Fields-td3627.html
which I will report for convenience:
Here, the original question was how to plot the vector field
F(x,y) = <x, 2y>
.The trick is in the plot "++", which is a special file name which allows to use functions in the
using
specifier.So, as @Jan said in his answer, gnuplot needs 4 fields in the data file to plot a vector field, but here the fields are synthetic and produced with two functions.
An equivalent formulation using defined functions could be:
See
help special-filenames
for further details.HIH