TIKZ 绘制矢量场

TIKZ 绘制矢量场

我怎样才能绘制这样的矢量场?在此处输入图片描述

答案1

是的,我知道这个问题有 Ti标题中的 Z。不过,我想提出一个渐近线解决方案,因为在我看来,这在真实 3D 图形上表现更好。使用 进行编译pdflatex -shell-escape

\documentclass[border=5pt]{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=AsyVF}
import graph3;
import three;
import solids;

size(6cm,8cm);
settings.render = 4;
currentprojection = perspective((9,4,4), up=Z,autoadjust=true);//,autoadjust=true
currentlight=(2,15,5);

// coordinate axes 
draw(-Z -- 2X-Z,L=Label("$x$",position=EndPoint));
draw(-Z -- 3Y-Z,L=Label("$y$", position=EndPoint));
draw(-Z -- 2Z,L=Label("$z$", position=EndPoint));

for (int irun=1; irun<=20; irun+=1)
{
real myx = sin(irun*2*pi/20);
real myy = -0.5;
real myz = cos(irun*2*pi/20);
draw(myx*X+myy*Y+myz*Z -- myx*X+myy*Y+myz*Z+(0.8+0.3*sin(irun*2*pi/10))*Y, arrow=Arrow3(), p=linewidth(0.5pt),light=currentlight);
//draw(shift(myx*X+myy*Y+myz*Z)*scale3(0.05)*unitsphere,lightgray,light=currentlight);
}

for (int irun=1; irun<=20; irun+=1)
{
real myx = sin(irun*2*pi/20);
real myy = 0.8;
real myz = cos(irun*2*pi/20);
draw(myx*X+myy*Y+myz*Z -- 1.2*myx*X+myy*Y+1.2*myz*Z+1.1*Y, arrow=Arrow3(), p=linewidth(0.5pt),light=currentlight);
//draw(shift(myx*X+myy*Y+myz*Z)*scale3(0.05)*unitsphere,lightgray,light=currentlight);
}

\end{asypicture}
\end{document}

在此处输入图片描述

相关内容