# Plotting an arbitrary function in latex [closed]

I would like to know how I can replicate the diagram below in latex.

thanks.

Edit: I can plot a function using tikz/pgfplots if I know how the function is defined. Unfortunately, I don't know how the function is defined in this case.

• Use pgfplots. See for example Easiest way to plot a function with PGF/TikZ. – Peter Grill Apr 12 '14 at 19:00
• Can you at least give the function that produces that graph? – Gonzalo Medina Apr 12 '14 at 19:02
• @GonzaloMedina There was no function. Well I guess the function is unknown. – Nana Apr 12 '14 at 19:04
• @Nana Well, you need to have some description of the function before you can plot anything. It seems that your question is more about maths (interpolation, approximation) than about plotting things in LaTeX... – jub0bs Apr 12 '14 at 19:19
• This question appears to be off-topic because it is more about how to derive a mathematical description for an unknown function than about actually plotting a function in LaTeX. The question may have to be migrated to Maths.SX. – jub0bs Apr 12 '14 at 19:20

Using pgfplots you can do something like this:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
domain=-1:7,
yticklabels=\empty,
xtick={-1,...,7},
xticklabels={-1,...,7},
samples=100
]
• I did: \documentclass[english,a4paper,11pt,oneside]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[domain=-.7:6.7,] \foreach \x/\xtext in {-1/-1, 1/1, 2/2, 3/3, 4/4, 5/5, 6/6, 7/7} \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$}; \draw[->] (-1.2,0) -- (7.2,0) node[right] {$x$}; \draw[->] (0,-6.2) -- (0,1.2) node[above] {$f(x)$}; \draw [samples=200] plot (\x,{-0.1*\x*(\x-3)*(\x-3)*(\x-6)}); \end{tikzpicture} \end{document} and works well also. Sorry, I can't go to newline in comments...? – MattAllegro Apr 13 '14 at 0:41