如何在不使用函数的情况下绘制矢量场?

如何在不使用函数的情况下绘制矢量场?

我想写一篇关于矢量场的文章,并用浴缸的例子给出一个例子。我想得到一个类似于这样的图:

在此处输入图片描述

图片来源:https://www.youtube.com/watch?v=0jW74lrpeM0&t=269s

此外,如果有任何函数可以产生类似的图形,那是可以的。

答案1

这就是你想要的吗?我只是用贝塞尔曲线上的箭头来装饰。

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[myarr/.style={decoration={markings,
mark=between positions 0.08 and .96 step #1
with { 
\draw[-stealth] (-.15,0)--(.15,0);
}},postaction={decorate}}]

%\draw[gray!50] (-2,-2) grid (6,2);
\clip (-2,-2) rectangle (6,2);
\path[red,myarr=.2] (0,0)--(4,0);
\path[red,myarr=.15] (0,0) .. controls +(30:1) and +(180-30:1) .. (4,0);
\path[red,myarr=.15] (0,0) .. controls +(60:1.5) and +(180-60:1.5) .. (4,0);
\path[red,myarr=.1] (0,0) .. controls +(90:2) and +(180-90:2) .. (4,0);
\path[red,myarr=.08] (0,0) .. controls +(120:3) and +(180-120:3) .. (4,0);
\path[red,myarr=.04] (0,0) .. controls +(150:6) and +(180-150:6) .. (4,0);
\path[red,myarr=.02] (0,0) .. controls +(165:15) and +(180-165:15) .. (4,0);
\path[red,myarr=.12] (0,0)--(-2,0) (6,0)--(4,0);

\path[red,myarr=.15] (0,0) .. controls +(-30:1) and +(180+30:1) .. (4,0);
\path[red,myarr=.15] (0,0) .. controls +(-60:1.5) and +(180+60:1.5) .. (4,0);
\path[red,myarr=.1] (0,0) .. controls +(-90:2) and +(180+90:2) .. (4,0);
\path[red,myarr=.08] (0,0) .. controls +(-120:3) and +(180+120:3) .. (4,0);
\path[red,myarr=.04] (0,0) .. controls +(-150:6) and +(180+150:6) .. (4,0);
\path[red,myarr=.02] (0,0) .. controls +(-165:15) and +(180+165:15) .. (4,0);

\fill[blue] (0,0) circle(2pt) (4,0) circle(2pt);
\end{tikzpicture}
\end{document}

相关内容