瀏覽代碼

added function x^3

Martin Thoma 13 年之前
父節點
當前提交
245fc4a131
共有 2 個文件被更改,包括 64 次插入0 次删除
  1. 31 0
      tikz/x-3-cubic-function/Makefile
  2. 33 0
      tikz/x-3-cubic-function/x-3-cubic-function.tex

+ 31 - 0
tikz/x-3-cubic-function/Makefile

@@ -0,0 +1,31 @@
+SOURCE = x-3-cubic-function
+DELAY = 80
+DENSITY = 300
+WIDTH = 500
+
+make:
+	pdflatex $(SOURCE).tex -output-format=pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
+
+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

+ 33 - 0
tikz/x-3-cubic-function/x-3-cubic-function.tex

@@ -0,0 +1,33 @@
+\documentclass[varwidth=true, border=2pt]{standalone}
+
+\usepackage{pgfplots}
+\usepackage{tikz}
+
+\begin{document}
+\begin{tikzpicture}
+    \begin{axis}[
+    legend pos=south east,
+        axis x line=middle,
+        axis y line=middle,
+        grid = major,
+        width=8cm,
+        height=12cm,
+        grid style={dashed, gray!30},
+        xmin=-2,     % start the diagram at this x-coordinate
+        xmax= 2,    % end   the diagram at this x-coordinate
+        ymin=-8,     % start the diagram at this y-coordinate
+        ymax= 8,   % end   the diagram at this y-coordinate
+        axis background/.style={fill=white},
+        xlabel=x,
+        ylabel=y,
+        %xticklabels={-2,-1.6,...,2},
+        %yticklabels={-8,-7,...,8},
+        tick align=outside,
+        enlargelimits=true,
+        tension=0.08]
+      % plot the stirling-formulae
+      \addplot[domain=-2:2, red, thick,samples=500] {x*x*x}; 
+      \addlegendentry{$f(x)=x^3$}
+    \end{axis} 
+\end{tikzpicture}
+\end{document}