Jelajahi Sumber

added sin-cos

Martin Thoma 11 tahun lalu
induk
melakukan
07a0da1e68
4 mengubah file dengan 73 tambahan dan 0 penghapusan
  1. 31 0
      tikz/sin-cos/Makefile
  2. 7 0
      tikz/sin-cos/Readme.md
  3. TEMPAT SAMPAH
      tikz/sin-cos/sin-cos.png
  4. 35 0
      tikz/sin-cos/sin-cos.tex

+ 31 - 0
tikz/sin-cos/Makefile

@@ -0,0 +1,31 @@
+SOURCE = sin-cos
+DELAY = 80
+DENSITY = 300
+WIDTH = 500
+
+make:
+	pdflatex -shell-escape $(SOURCE).tex -output-format=pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot *.table
+
+gif:
+	pdfcrop $(SOURCE).pdf
+	convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
+	make clean
+
+png:
+	make
+	make svg
+	inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
+
+transparentGif:
+	convert $(SOURCE).pdf -transparent white result.gif
+	make clean
+
+svg:
+	#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
+	pdf2svg $(SOURCE).pdf $(SOURCE).svg
+	# Necessary, as pdf2svg does not always create valid svgs:
+	inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

+ 7 - 0
tikz/sin-cos/Readme.md

@@ -0,0 +1,7 @@
+This should replace http://commons.wikimedia.org/wiki/File:Sinusburst.png
+
+Compiled example
+----------------
+![Example](sin-cos.png)
+
+

TEMPAT SAMPAH
tikz/sin-cos/sin-cos.png


+ 35 - 0
tikz/sin-cos/sin-cos.tex

@@ -0,0 +1,35 @@
+\documentclass{article}
+\usepackage[pdftex,active,tightpage]{preview}
+\setlength\PreviewBorder{0mm}
+
+\usepackage{pgfplots}
+\pgfplotsset{compat=1.9}
+
+\begin{document}
+\begin{preview}
+\begin{tikzpicture}[scale=0.5]
+    \begin{axis}[
+        axis x line=middle,
+        axis y line=middle,
+        enlarge y limits=true,
+        enlarge x limits=true,
+        xmin=0, xmax=2*pi, % x domain
+        width=15cm, height=8cm,     % size of the image
+        grid = major,
+        grid style={dashed, gray!30},
+        ymin=-1,      % start the diagram at this y-coordinate
+        ymax= 1,      % end   the diagram at this y-coordinate
+        axis background/.style={fill=white},
+        ylabel=$y$,
+        xlabel=$x$,
+        xtick={0,1.5708,3.14159,4.7123889,6.2830},
+        xticklabels={$0$,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$,$2\pi$},
+        legend style={at={(0.2,0.37)}, anchor=north}
+     ]
+      \addplot[domain=-8:8,thick,samples=200,red]   {sin(deg(x))};
+      \addplot[domain=-8:8,thick,samples=200,blue,dotted]   {cos(deg(x))};
+      \legend{$\sin x$, $\cos x$}
+    \end{axis} 
+\end{tikzpicture}
+\end{preview}
+\end{document}