4

Sorry for the undetailed title, I didn't know what to call this. How can I draw the image below in TiKz or PSTricks?

enter image description here

3

It is recommended to use standalone document class for each diagram and compile it with either latex-dvips-ps2pdf or xelatex. The resulting output is a PDF file that you can import with \includegraphics into your main document.

enter image description here

\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}

Attenuated version:

enter image description here

\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}
  • I see you have utilized -sin (x) is it possible to have a lower amplitude at the beginning? – Jeel Shah May 14 '13 at 20:33
  • Did you mean the wave gets attenuated? – kiss my armpit May 14 '13 at 20:35
  • Yes, at beginning the wave is thinner and gradually it gets bigger. EDIT: I tried putting your code into an article class but it's not working. – Jeel Shah May 14 '13 at 20:37
  • See my edit on the top and bottom. It should be better to separate your code for diagrams from the main input file thereby your main input file becomes cleaner in addition to reducing the compilation time. – kiss my armpit May 14 '13 at 20:43
2

An option using 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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.