再生轨道波

再生轨道波

我正在尝试重现下图:

在此处输入图片描述

到目前为止,我已经能够使用 Tikz 执行以下操作:

\begin{tikzpicture}
   \def\r{1cm}
   \def\v{2.5mm}
   \foreach \n in {2,3,4,5,6}{
      \begin{scope}[xshift=\n*2*(\r+\v+1mm)]
         \draw[thick]  (0:{\r+\v})
         \foreach \a in {1,...,359}{ -- (\a:{\r+cos(\a*\n)*\v}) } -- cycle;
            \draw[dashed] circle (\r);
         \end{scope}
      }
  \end{tikzpicture}

其结果是:

在此处输入图片描述

但我被困住了,无法继续前进。任何帮助我都非常感谢。

答案1

第一种方法,带有几个嵌套循环和一个声明的函数(可能需要改进)。

更新:我添加了角度。

\documentclass[tikz,border=2mm]{standalone}
\tikzset
{% \x = angle, \h=wave height, \n=wave number
   declare function={wave(\x,\h,\n)=1+\h*sin(\n*\x-90*(\n-1));}
}
\begin{document}
\begin{tikzpicture}
\foreach\i in {2,...,6}
{
  \begin{scope}[shift={(3.5*\i,0)}]
    \node at (0,1.75) {$n=\i$};
    \draw[thick] (0,0) circle (1);
    \foreach\j in {0.1,0.2,0.3,0.4}
      \draw plot[domain=0:360,samples=181] ({wave(\x,\j,\i)*cos(\x)},{wave(\x,\j,\i)*sin(\x)});
   \pgfmathsetmacro\sa{-90+90*(4*\i-3)/\i} % start angle
   \pgfmathsetmacro\ea{\sa+360/\i}         % end angle
   \draw (\sa:2) -- (0,0) -- (\ea:2);
   \draw[latex-latex] (\sa:1.75) arc (\sa:\ea:1.75) node[midway,fill=white] {$\lambda_\i$};
   \end{scope}
}
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

因为我太爱pics 了:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\newif\iforbitalwavedrawlabel
\tikzset{
    pics/orbital wave/.style={
        code={
            \tikzset{orbital wave/.cd, #1}
            \foreach \s [evaluate=\s as \t using \s/(\pgfkeysvalueof{/tikz/orbital wave/steps} + 1)] 
                in {0,...,\pgfkeysvalueof{/tikz/orbital wave/steps}} {
                \ifnum\s=0\relax
                    \draw[orbital wave/circle] 
                \else
                    \ifnum\s=\pgfkeysvalueof{/tikz/orbital wave/steps}\relax
                        \draw[orbital wave/wave] 
                    \else
                        \draw[orbital wave/step] 
                    \fi
                \fi
                    plot[domain=0:360, samples=181]
                    ({\x}:{
                        \pgfkeysvalueof{/tikz/orbital wave/circle radius} +
                        cos(\x * \pgfkeysvalueof{/tikz/orbital wave/frequency}) *
                        \pgfkeysvalueof{/tikz/orbital wave/amplitude} * \t
                    });
            }
            \iforbitalwavedrawlabel
            \draw[orbital wave/segment] 
                (\pgfkeysvalueof{/tikz/orbital wave/segment start angle}:\pgfkeysvalueof{/tikz/orbital wave/segment radius}) 
                -- (0,0) 
                -- (\pgfkeysvalueof{/tikz/orbital wave/segment end angle}:\pgfkeysvalueof{/tikz/orbital wave/segment radius});
            \draw[orbital wave/segment angle] 
                (\pgfkeysvalueof{/tikz/orbital wave/segment start angle}:{\pgfkeysvalueof{/tikz/orbital wave/segment radius}-\pgfkeysvalueof{/tikz/orbital wave/segment label indent}}) 
                arc[start angle=\pgfkeysvalueof{/tikz/orbital wave/segment start angle}, end angle=\pgfkeysvalueof{/tikz/orbital wave/segment end angle}, radius={\pgfkeysvalueof{/tikz/orbital wave/segment radius}-\pgfkeysvalueof{/tikz/orbital wave/segment label indent}}] 
                node[orbital wave/segment label] {\pgfkeysvalueof{/tikz/orbital wave/segment label text}};
            \fi
        }
    },
    orbital wave/steps/.initial={2},
    orbital wave/frequency/.initial={3},
    orbital wave/amplitude/.initial={1cm},
    orbital wave/circle radius/.initial={1cm},
    orbital wave/circle/.style={dashed},
    orbital wave/step/.style={thin},
    orbital wave/wave/.style={thick},
    orbital wave/draw label/.is if={orbitalwavedrawlabel},
    orbital wave/draw label,
    orbital wave/segment/.style={thin},
    orbital wave/segment angle/.style={stealth-stealth},
    orbital wave/segment label/.style={midway, circle, fill=white, inner sep=1pt},
    orbital wave/segment label indent/.initial={5pt},
    orbital wave/segment radius/.initial={2.5cm},
    orbital wave/segment start angle/.initial={90/\pgfkeysvalueof{/tikz/orbital wave/frequency}},
    orbital wave/segment end angle/.initial={450/\pgfkeysvalueof{/tikz/orbital wave/frequency}},
    orbital wave/segment label text/.initial={$\lambda_{\pgfkeysvalueof{/tikz/orbital wave/frequency}}$},
}

\begin{document}
\begin{tikzpicture}

\pic at (0,5) {orbital wave};

\pic[rotate=90] at (0,0)  {orbital wave={
        steps=4, 
        frequency=6, 
        amplitude=0.5cm, 
        wave/.append style={violet}
    }};

\pic at (5,1.75)  {orbital wave={
        steps=6, 
        frequency=10, 
        circle radius=2cm, 
        draw label=false, 
        circle/.style={red}, 
        step/.style={red!25}
    }};

\pic at (5,6) {orbital wave={
        frequency=4, 
        circle radius=0.5cm, 
        amplitude=0.25cm, 
        segment radius=1cm, 
        segment label indent=0pt,
        segment label text={\pgfkeysvalueof{/tikz/orbital wave/frequency}}, 
        segment label/.append style={text=green!75!black}, 
        segment/.style={red},
        segment angle/.style={blue},
        wave/.append style={orange}
    }};

\end{tikzpicture}
\end{document}  

在此处输入图片描述


您展示的图片似乎包含某种偏移副本,因此我将其添加到pic

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\newif\iforbitalwavedrawlabel
\newif\iforbitalwaveoffsetcopy
\tikzset{
    pics/orbital wave/.style={
        code={
            \tikzset{orbital wave/.cd, #1}
            \foreach \s [evaluate=\s as \t using \s/(\pgfkeysvalueof{/tikz/orbital wave/steps} + 1)] 
                in {0,...,\pgfkeysvalueof{/tikz/orbital wave/steps}} {
                \ifnum\s=0\relax
                    \draw[orbital wave/circle] 
                \else
                    \ifnum\s=\pgfkeysvalueof{/tikz/orbital wave/steps}\relax
                        \draw[orbital wave/wave] 
                    \else
                        \draw[orbital wave/step] 
                    \fi
                \fi
                    plot[domain=0:360, samples=181]
                    ({\x}:{
                        \pgfkeysvalueof{/tikz/orbital wave/circle radius} +
                        cos(\x * \pgfkeysvalueof{/tikz/orbital wave/frequency}) *
                        \pgfkeysvalueof{/tikz/orbital wave/amplitude} * \t
                    });
                \iforbitalwaveoffsetcopy
                    \ifnum\s=0\relax\else
                        \draw[orbital wave/copy] plot[domain=0:360, samples=181]
                            ({\x + 180/\pgfkeysvalueof{/tikz/orbital wave/frequency}}:{
                                \pgfkeysvalueof{/tikz/orbital wave/circle radius} +
                                cos(\x * \pgfkeysvalueof{/tikz/orbital wave/frequency}) *
                                \pgfkeysvalueof{/tikz/orbital wave/amplitude} * \t
                            });
                    \fi
                \fi
            }
            \iforbitalwavedrawlabel
            \draw[orbital wave/segment] 
                (\pgfkeysvalueof{/tikz/orbital wave/segment start angle}:\pgfkeysvalueof{/tikz/orbital wave/segment radius}) 
                -- (0,0) 
                -- (\pgfkeysvalueof{/tikz/orbital wave/segment end angle}:\pgfkeysvalueof{/tikz/orbital wave/segment radius});
            \draw[orbital wave/segment angle] 
                (\pgfkeysvalueof{/tikz/orbital wave/segment start angle}:{\pgfkeysvalueof{/tikz/orbital wave/segment radius}-\pgfkeysvalueof{/tikz/orbital wave/segment label indent}}) 
                arc[start angle=\pgfkeysvalueof{/tikz/orbital wave/segment start angle}, end angle=\pgfkeysvalueof{/tikz/orbital wave/segment end angle}, radius={\pgfkeysvalueof{/tikz/orbital wave/segment radius}-\pgfkeysvalueof{/tikz/orbital wave/segment label indent}}] 
                node[orbital wave/segment label] {\pgfkeysvalueof{/tikz/orbital wave/segment label text}};
            \fi
        }
    },
    orbital wave/steps/.initial={2},
    orbital wave/frequency/.initial={3},
    orbital wave/amplitude/.initial={1cm},
    orbital wave/circle radius/.initial={1cm},
    orbital wave/circle/.style={dashed},
    orbital wave/step/.style={thin},
    orbital wave/copy/.style={orbital wave/step},
    orbital wave/wave/.style={thick},
    orbital wave/offset copy/.is if={orbitalwaveoffsetcopy},
    orbital wave/offset copy,
    orbital wave/draw label/.is if={orbitalwavedrawlabel},
    orbital wave/draw label,
    orbital wave/segment/.style={thin},
    orbital wave/segment angle/.style={stealth-stealth},
    orbital wave/segment label/.style={midway, circle, fill=white, inner sep=1pt},
    orbital wave/segment label indent/.initial={5pt},
    orbital wave/segment radius/.initial={2.5cm},
    orbital wave/segment start angle/.initial={90/\pgfkeysvalueof{/tikz/orbital wave/frequency}},
    orbital wave/segment end angle/.initial={450/\pgfkeysvalueof{/tikz/orbital wave/frequency}},
    orbital wave/segment label text/.initial={$\lambda_{\pgfkeysvalueof{/tikz/orbital wave/frequency}}$},
}

\begin{document}
\begin{tikzpicture}

\pic at (-4,0) {orbital wave={
        steps=4, 
        amplitude=0.5cm, 
        wave/.append style={red},
        draw label=false,
        offset copy=false
    }};
    
\pic at (0,0) {orbital wave={
        steps=4, 
        amplitude=0.5cm, 
        wave/.append style={red},
        draw label=false
    }};

\pic at (4,0) {orbital wave={
        steps=4, 
        amplitude=0.5cm, 
        wave/.append style={red},
        copy/.append style={blue},
        draw label=false
    }};

\pic[rotate=90] at (-4,-4) {orbital wave={
        steps=4, 
        frequency=2,
        amplitude=0.5cm, 
        segment radius=2cm,
        step/.style={gray},
        circle/.style={solid, gray},
        wave/.append style={violet}
    }};

\pic[rotate=150] at (0,-4) {orbital wave={
        steps=4, 
        frequency=3,
        amplitude=0.5cm, 
        segment radius=2cm,
        step/.style={gray},
        circle/.style={solid, gray},
        wave/.append style={violet}
    }};

\pic[rotate=180] at (4,-4) {orbital wave={
        steps=4, 
        frequency=4,
        amplitude=0.5cm, 
        segment radius=2cm,
        step/.style={gray},
        circle/.style={solid, gray},
        wave/.append style={violet}
    }};

\end{tikzpicture}
\end{document}  

在此处输入图片描述

相关内容