如何绘制参考信号的第三次谐波注入

如何绘制参考信号的第三次谐波注入

我是使用 TIKZ latex 包绘制图表的新手。我想绘制一个类似于附图的第三谐波注入图。Nb,Theta(1)= pi/3......Theta (2)= 2*pi/3

这是代码草稿(我的初次尝试),但显然它不符合所需的情节

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\hspace*{\fill}
\begin{tikzpicture}
\begin{axis}
[width=4in, axis equal image,
          xmin=0, xmax=3,
          ymin=-1.5, ymax=1.5,
          axis lines=center,
          %enlargelimits,
          %axis line style={shorten >=-0.25cm,shorten <=-0.25cm,latex-latex},
          ticklabel style={fill=white},
          extra x ticks={0},
          xlabel=$x$,ylabel=$y$,
          clip=false,]

\addplot[domain=0:2.5,mark=none,samples=200] {abs(sin(deg(pi*x)))} node[fill=white, right]{$y=\vert\sin(\ x)\vert$};

\addplot[domain=0:2.5,mark=none,draw=red,samples=200] {abs(0.5*sin(deg(pi*3*x)))} node[fill=white, right]{$y=\vert\ 0.5* sin(\ 3 * x)\vert$};

\end{axis}
\end{tikzpicture}
\end{document}

三次谐波注入 请帮忙

答案1

编辑

根据要求添加了 Theta 1 和 Theta 2。

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\hspace*{\fill}
\begin{tikzpicture}
\begin{axis}
[width=4in, axis equal image,
          xmin=0, xmax=3,
          ymin=-1.5, ymax=1.5,
          axis lines=center,
          %enlargelimits,
          %axis line style={shorten >=-0.25cm,shorten <=-0.25cm,latex-latex},
          ticklabel style={fill=white},
          %extra x ticks={0},
          xlabel=$x$,ylabel=$y$,
          clip=false,]

\addplot[domain=0:2.5,mark=none,draw=blue,samples=200] {sin(deg(pi*x))} node[blue, right]{$y=\sin x$};

\addplot[domain=0:2.5,mark=none,draw=red,samples=200] {0.25*sin(deg(pi*3*x))} node[red,right,yshift=-3pt]{$y= 0.25 \sin 3x$};

\addplot[domain=0:2.5,mark=none,draw=green!50!black,samples=200] {sin(deg(pi*x))+0.25*sin(deg(pi*3*x))} node[green!50!black, right]{Sum};

\newcommand{\uplim}{0.895}
\newcommand{\ta}{0.27}
\draw (axis cs:0,1) -- (axis cs:1.5,1);
\draw (axis cs:0,\uplim) -- (axis cs:1.5,\uplim);
\draw[densely dashed] (axis cs:\ta,\uplim) -- (axis cs:\ta,0) node[below]{$\theta_1$};
\draw[densely dashed] (axis cs:1-\ta,\uplim) -- (axis cs:1-\ta,0) node[below]{$\theta_2$};


\end{axis}
\end{tikzpicture}
\end{document}

三次谐波

相关内容