sin(1divx).tex 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{pgfplots}
  5. \usepackage{tikz}
  6. \usetikzlibrary{arrows, positioning, calc}
  7. \begin{document}
  8. \begin{preview}
  9. \begin{tikzpicture}
  10. \begin{axis}[
  11. axis x line=middle,
  12. axis y line=left,
  13. enlarge y limits=true,
  14. xmode=log, % Logarithmic x axis
  15. xmin=0.01, xmax=1, % Positive domain...
  16. xticklabel=\pgfmathparse{exp(\tick)}\pgfmathprintnumber{\pgfmathresult},
  17. xticklabel style={/pgf/number format/.cd,fixed}, % Use fixed point notation
  18. width=15cm, height=8cm, % size of the image
  19. grid = major,
  20. grid style={dashed, gray!30},
  21. ymin=-1, % start the diagram at this y-coordinate
  22. ymax= 1, % end the diagram at this y-coordinate
  23. axis background/.style={fill=white},
  24. ylabel=$y$,
  25. xlabel=$x$,
  26. legend style={at={(0.9,0.95)}, anchor=north}
  27. ]
  28. \addplot[domain=0.01:1, red, thick,samples=2000] {-sin(deg(1/(x)))};
  29. \legend{$\sin(\frac{1}{x})$}
  30. \end{axis}
  31. \end{tikzpicture}
  32. \end{preview}
  33. \end{document}