Grafika: függvény rajzolás I.

Ábrázolni szeretnénk az függvényt a [-1.5;2] intervallumon.

 

A preambulumba

\usepackage{tikz}

 

A megfelelő helyre

\begin{tikzpicture}
\draw[samples=100,domain=-1.5:2,smooth,line width=1.4pt,variable=\x] plot ({\x},{abs( (\x)^2-1)});
\end{tikzpicture}

utasítást.

tex 0001

 

 

Ha koordinátarendszerben szeretnénk megjeleníteni, akkor

\begin{tikzpicture}
\draw [color=gray!40] (-2.5,-1.5) grid (2.5,3.5);
\draw [line width=1.6pt,->] (-2.5,0) to (2.5,0);
\draw [line width=1.6pt,->] ( 0,-1.5) to (0,3.5);
\node at (-0.3,-0.3) {$O$};
\node at (1,-0.3) {$1$};
\node at (2.5,-0.3) {$X$};
\node at (-0.3,1) {$1$};
\node at (0.2,3.5) {$Y$};
\draw[samples=100,domain=-1.5:2,smooth,line width=1.4pt,variable=\x] plot ({\x},{abs( (\x)^2-1)});
\end{tikzpicture}

tex 0001