如何在 Tikz/PSTricks 中绘制波形图

如何在 Tikz/PSTricks 中绘制波形图

抱歉,标题不够详细,我不知道该怎么称呼它。如何在 TiKz 或 PSTricks 中绘制下面的图像?

在此处输入图片描述

答案1

建议standalone对每个图表使用文档类,并使用 或 进行编译latex-dvips-ps2pdfxelatex生成的输出是一个 PDF 文件,您可以将其导入\includegraphics到主文档中。

在此处输入图片描述

\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pst-plot,pst-node}
\begin{document}
\begin{pspicture}(-2,-.5)(2,7)
    \psaxes[labels=none,ticks=none](0,0)(-2,0)(2,6.5)
    \psplot[algebraic,swapaxes]{0}{Pi 2 mul}{-sin(x)}
    \pscircle[fillstyle=solid](!0 Pi 2 mul){3pt}
    \pcline{->}(!0 Pi 2 div)(!-1 Pi 2 div)
    \naput{$r$}
    \pcline{->}(1,0)(1,1)
    \naput{$x$}
\end{pspicture}
\end{document}

减弱版本:

在此处输入图片描述

\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pst-plot,pst-node}
\def\f{-sin(x)*1.2^(-2*x)}
\begin{document}
\begin{pspicture}(-2,-.5)(2,7)
    \psaxes[labels=none,ticks=none](0,0)(-2,0)(2,6.5)
    \psplot[algebraic,swapaxes]{0}{Pi 2 mul}{\f}
    \pscircle[fillstyle=solid](!0 Pi 2 mul){3pt}
    \pcline{->}(!0 Pi 2 div)(!-.55 Pi 2 div)
    \naput{$r$}
    \pcline{->}(1,0)(1,1)
    \naput{$x$}
\end{pspicture}
\end{document}

答案2

使用 TikZ 的选项:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}

\begin{document}

\begin{tikzpicture}[thick]
\draw (0,0) -- +(0,-7);
\draw (-1.5,-7) -- (1.5,-7);
\draw (0,-7) .. controls (-2,-5) and (1,-2) .. (0,-2pt);
\begin{scope}[myarrow/.style={single arrow,draw,inner sep=2pt,text width=#1,single arrow head extend=2.5pt,thin}]
\node[myarrow=5pt,label=below:$r$,xscale=-1] at (-0.3,-5) {};
\node[myarrow=12pt,label=above:$x$,rotate=90] at (0.8,-6.5) {};
\end{scope}
\fill[white,draw=black] (0,0) circle[radius=4pt];
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容