latex 中手动修改 cos

latex 中手动修改 cos

在此处输入图片描述后续行动在 LaTeX 中制作手动图片

如果我按如下方式修改它,我应该更改域吗?据我理解,这里没有提到域,因为没有内置函数,几乎没有,而是通过定义它们来呈现图片中的所有内容。

正是如此,我希望图片清晰可见。现在我想以这些方式更改图形,我想知道是否应该应用内置的 cos 函数?因为据我了解,标记的点和适应这些点的手动曲线。我可能也理解错了 :)

\begin{tikzpicture}[,scale=1.5,xscale=0.75]
        % axes
        \draw[-latex] (0,0)       -- (2*pi+0.5,0) node[right] {$\theta$};
        \draw[-latex] (0,-1.5)    -- (0,1.5)      node[left]  {$Y$};
        % auxiliary lines
        \draw[teal,dashed]      (0,1)       -- (2*pi,1);
        \draw[teal]             (2*pi,-1.5) -- (2*pi,1.5);
        \draw[latex-latex,teal] (pi,0)    -- (pi,1)        node[fill=white,midway] {\small amplitude};
        \draw[latex-latex,teal] (0,-1.25) -- (2*pi,-1.25)  node[fill=white,midway] {\small basic interval $2\pi$};
        \draw[latex-latex,teal] (0,1.25)    -- (2*pi,1.25) node[fill=white,midway,
        yshift=1mm,text width=2cm,
        align=center]      {\small period}; %cycle wavelength;
        % ticks
        \foreach\i in {-1,0,+1}
        \node[left] at (0,\i) {$\i$};
        \node[below]             at (0.5*pi,0) {$\frac{\pi}{2}$};
        \node[below]             at (pi,0)     {$\pi$};
        \node[below,xshift=1mm]  at (1.5*pi,0) {$\frac{3\pi}{2}$};
        \node[below,fill=white]  at (2*pi,0)   {$2\pi$};
        % cos
        \draw[black,thick]  (0,1) cos (0.5*pi,0) sin (pi,-1) cos (1.5*pi,0) sin (2*pi,1);
    \end{tikzpicture}

答案1

现在我知道你需要什么了。你知道,有时候一张照片很有价值……如果我们需要一张照片,那显然就值很多钱 XD。

我给你两个选择:

  • 如果你想要类似链接答案的东西,你可以使用shift函数(你还需要一个sin)并将clip其到域[0,2π]:
\clip (0,-1.5) rectangle (2*pi,1.5);
\draw[black,thick,shift={(pi/6,0)}] (-0.25*pi,0) sin (0,1) cos (0.25*pi,0) ...
  • 或者,您可以使用plot适当的功能:
\draw[red,dashed,thick]  plot[domain=0:2*pi,samples=81] (\x,{cos(deg(2*(\x-pi/6))});

我把两个选项重叠起来画出来,这样你就能看到它们给出相同的输出。选择你喜欢的就行。

完整示例:

\documentclass[tikz,border=1.618mm]{standalone}

\begin{document}
\begin{tikzpicture}[scale=1.5,xscale=0.75]
  % axes
  \draw[-latex] (0,0)       -- (2*pi+0.5,0) node[right] {$\theta$};
  \draw[-latex] (0,-1.5)    -- (0,1.5)      node[left]  {$Y$};
  % auxiliary lines
  \draw[teal,dashed]      (0,1)       -- (2*pi,1);
  \draw[teal]             (2*pi,-1.5) -- (2*pi,1.5);
  \draw[latex-latex,teal] (0.5*pi,0)  -- (0.5*pi,1)   node[fill=white,midway] {\small amplitude};
  \draw[latex-latex,teal] (0,-1.25)   -- (2*pi,-1.25) node[fill=white,midway] {\small basic interval $2\pi$};
  \draw[latex-latex,teal] (pi,1.4)    -- (2*pi,1.4)   node[fill=white,midway,text width=2cm,align=center]
                                                                              {\small wavelength period cycle};
  % ticks
  \foreach\i in {0.5,1,1.5}
     \draw (\i*pi,0.05) -- (\i*pi,-0.05);
  \foreach\i in {-1,0,+1} 
  \node[left] at (0,\i) {$\i$};
    \node[below]           at (0.5*pi,0) {$\frac{\pi}{2}$};
  \node[below]             at (pi,0)     {$\pi$};
  \node[below]             at (1.5*pi,0) {$\frac{3\pi}{2}$};
  \node[below,fill=white]  at (2*pi,0)   {$2\pi$};
  % cos (two options, choose whatever you prefer)
  \draw[black,thick] (0,1) cos (0.25*pi,0) sin (0.5*pi,-1) cos (0.75*pi,0) sin (pi,1)
                           cos (1.25*pi,0) sin (1.5*pi,-1) cos (1.75*pi,0) sin (2*pi,1);
  \draw[red,dashed,thick]  plot[domain=0:2*pi,samples=81] (\x,{cos(2*\x r)});
\end{tikzpicture}

\begin{tikzpicture}[scale=1.5,xscale=0.75]
  % axes
  \draw[-latex] (0,0)       -- (2*pi+0.5,0) node[right] {$\theta$};
  \draw[-latex] (0,-1.5)    -- (0,1.5)      node[left]  {$Y$};
  % auxiliary lines
  \draw[teal,dashed]      (0,1)       -- (2*pi,1);
  \draw[teal]             (2*pi,-1.5) -- (2*pi,1.5);
  \draw[latex-latex,teal] (2*pi/3,0)  -- (2*pi/3,1)   node[fill=white,midway] {\small amplitude};
  \draw[latex-latex,teal] (0,-1.25)   -- (2*pi,-1.25) node[fill=white,midway] {\small basic interval $2\pi$};
  \draw[latex-latex,teal] (0,-0.75)   -- (pi/6,-0.75) node[midway,below]      {\small$\frac{\pi}{6}$};
  \draw[teal,dashed]      (pi/6,-1)   -- (pi/6,1);    
  % ticks
  \foreach\i in {0.5,1,1.5}
    \draw (\i*pi,0.05) -- (\i*pi,-0.05);
  \foreach\i in {-1,0,+1}
    \node[left] at (0,\i) {$\i$};
  \node[below]             at (0.5*pi,0) {$\frac{\pi}{2}$};
  \node[below]             at (pi,0)     {$\pi$};
  \node[below]             at (1.5*pi,0) {$\frac{3\pi}{2}$};
  \node[below,fill=white]  at (2*pi,0)   {$2\pi$};
  % cos (two options, choose whatever you prefer)
  \clip (0,-1.5) rectangle (2*pi,1.5);
  \draw[black,thick,shift={(pi/6,0)}] (-0.25*pi,0) sin (0,1) cos (0.25*pi,0) sin (0.5*pi,-1) cos (0.75*pi,0) sin (pi,1)
                                                             cos (1.25*pi,0) sin (1.5*pi,-1) cos (1.75*pi,0) sin (2*pi,1);
  \draw[red,dashed,thick]  plot[domain=0:2*pi,samples=81] (\x,{cos(deg(2*(\x-pi/6))});
\end{tikzpicture}
\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容