M

Chiudi

Grafici con Tikz numero 1 (grafico di una funzione)

Immagini matematica

Home » Grafici con Tikz numero 1 (grafico di una funzione)


Di seguito il grafico di una funzione e poi il codice.

Rendered by QuickLaTeX.com

Codice che ha generato il grafico di sopra. 

\documentclass[usenames,dvipsnames]{article}
\usepackage{pgfplots}

\begin{center}\begin{tikzpicture}
\begin{axis}[
axis x line=center,
axis y line=center,
width = 1\textwidth,
height = 0.8\textwidth,
xmin = -7.95,
xmax = 7.95,
ymin = -1.5,
ymax = 1.5,
xtick = \empty,
ytick = \empty,
xlabel = {$x$},
ylabel = {$y$},
extra x ticks = {0},
extra x tick label = {$\hspace{-0.6cm}0$},
]

\addplot[dashed,domain=-10:0,samples=200,red] {0.52};
\addplot[domain=0:10,samples=100,red,dashed] {-0.52};
\addplot[red,domain=-10:10,samples=100,very thick,] {1/(e^x+1)-1/2};
\draw (axis cs:3,-0.3) node[rotate=-15] {$y=\frac{1}{e^x+1}-1/2$};
\draw (axis cs:0.5,0.52) node[rotate=0] {$1/2$};
\draw (axis cs:-0.8,-0.52) node[rotate=0] {$-1/2$};
\end{axis}
\end{tikzpicture}\end{center}