曲线的切向量

曲线的切向量

代码:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.markings}

\usepackage[margin=1in]{geometry}

\begin{document}
    \begin{figure}[h!]
        \centering
        \begin{tikzpicture}
            \begin{axis}[view={120}{20},
                height = 4in,width=4in,
                axis lines=center,axis on top,
              no marks,axis equal,
                xmin=-1.5,xmax=1.5,ymin=-1.5,ymax=1.5,zmin=-1.5,zmax=1.5,
             enlargelimits={upper=0.1}]
                    \addplot3+[color = blue, thick, no markers,samples=250, samples y=0,domain=0:2*pi,variable=\t, decoration={
    markings,
    mark=between positions 0.01 and .999 step 2em with {\arrow [scale=1]{stealth}}
    }, postaction=decorate]({sin(\t r)},{sin(2*\t r)},{sin(3*\t r)});
                    \draw[color = red, very thick,-latex] ({sin(3 r)}, {sin(6 r)}, {sin(9 r)}) -- ++({cos(3 r)}, {2*cos(6 r)}, {3*cos(9 r)});
            \end{axis}
        \end{tikzpicture}   
    \end{figure}
\end{document}

阴谋:

在此处输入图片描述

如何正确绘制 t = 2 处曲线的切线?

答案1

您已经放置了大量切线箭头,因此您可以使用相同的策略在一秒钟内放置完整的箭头postaction。由于t02pi,并且您想将箭头放置在t=2,因此位置为1/pi。请注意,使用带单位的坐标很重要,即

\draw[color = red, very thick,-latex]  (-0.5cm,0cm) -- (0.5cm,0cm);

使箭头平行,否则您将使用由 安装的坐标系pgfplots

\documentclass[12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{decorations.markings}
\usepackage[margin=1in]{geometry}

\begin{document}
    \begin{figure}[h!]
        \centering
        \begin{tikzpicture}
            \begin{axis}[view={120}{20},
                height = 4in,width=4in,
                axis lines=center,axis on top,
              no marks,axis equal,
                xmin=-1.5,xmax=1.5,ymin=-1.5,ymax=1.5,zmin=-1.5,zmax=1.5,
             enlargelimits={upper=0.1}]
    \addplot3+[color = blue, thick, no markers,samples=250, samples y=0,domain=0:2*pi,variable=\t, 
    postaction={decorate,decoration={
    markings,
    mark=between positions 0.01 and .999 step 2em with {\arrow [scale=1]{stealth}},
    }},
    postaction={decorate,decoration={
    markings,
    mark=at position 1/pi with {
        \draw[color = red, very thick,-latex] 
    (-0.5cm,0cm) -- (0.5cm,0cm);
    }
    }}
    ]({sin(deg(\t))},{sin(deg(2*\t))},{sin(deg(3*\t))});
                    
            \end{axis}
        \end{tikzpicture}   
    \end{figure}
\end{document}

在此处输入图片描述

您可以计算给定 处的速度t。(原则上,您也可以通过分析计算切线,因此这种混合答案有点无意义,但这是一个 LaTeX 答案,所以我们让 LaTeX 找出斜率。我们也可以让它以数字方式找出速度,也许在另一天。当然,位置也只是一个近似值。)

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{decorations.markings}
\begin{document}
\foreach \myt in {0.2,0.4,...,6.2}        
{\begin{tikzpicture}        
  \begin{axis}[view={120}{20},
                height = 4in,width=4in,
                axis lines=center,axis on top,
              no marks,axis equal,
                xmin=-1.5,xmax=1.5,ymin=-1.5,ymax=1.5,zmin=-1.5,zmax=1.5,
             enlargelimits={upper=0.1}]
    \addplot3+[color = blue, thick, no markers,samples=250, samples y=0,domain=0:2*pi,variable=\t, 
    postaction={decorate,decoration={
    markings,
    mark=between positions 0.01 and .999 step 2em with {\arrow [scale=1]{stealth}},
    }},
    postaction={decorate,decoration={
    markings,
    mark=at position {\myt/2/pi} with {
        \pgfmathsetmacro{\mylen}{sqrt(pow(cos(deg(\myt)),2)+pow(2*cos(deg(2*\myt)),2)+pow(3*cos(3*deg(\myt)),2))}
        \draw[color = red, very thick,-latex,overlay] 
    (0cm,0cm) -- (0.5*\mylen*1cm,0cm);
    }
    }}
    ]({sin(deg(\t))},{sin(deg(2*\t))},{sin(deg(3*\t))});
                    
  \end{axis}
\end{tikzpicture}}
\end{document}

在此处输入图片描述

相关内容