0

How do I draw this function on Tikz or any other alternative?enter image description here?

0
4

You can use pgfplots with unbounded coords=jump. Then you can use a function that has the right poles and asymptotics, and plot it. It is usually a good idea to keep the number of samples odd for a symmetric function.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}[declare function = {f(\x)=4-8*\x*\x/((\x-3)*(\x+3));}]
    \begin{axis}[width=10cm,axis lines=center,unbounded coords=jump,
           xlabel=$x$,xlabel style={anchor=north east},
           xtick=\empty,ytick=\empty,
           ylabel=$y$,
           ymin=-12,ymax=12,xmin=-10,xmax=10
                ]
     \addplot [domain=-10:10, samples=201] {f(x)};
     \addplot[dashed]  coordinates {(\pgfkeysvalueof{/pgfplots/xmin},-4) (\pgfkeysvalueof{/pgfplots/xmax},-4)};
     \addplot[dashed]  coordinates {(-3,\pgfkeysvalueof{/pgfplots/ymin}) (-3,\pgfkeysvalueof{/pgfplots/ymax})};
     \addplot[dashed]  coordinates {(3,\pgfkeysvalueof{/pgfplots/ymin}) (3,\pgfkeysvalueof{/pgfplots/ymax})};
     \path (-3,0) node[below left] {$-3$} (3,0) node[below right] {$3$}
      (0,4) node[below right] {$4$} (0,-4) node[below right] {$-4$}
      (0,0) node[below left] {$O$};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1

An example can be:

\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
 declare function = {f(\t)=(6*(\t)^2-3*\t+4)/(2*(\t)^2-8);},
       axis lines = center,
           xlabel = $x$,
     xlabel style = {anchor=north east},
           ylabel = $y$,
ymin = -100, ymax = 100,
                ]
\addplot [red, thick, domain=-5:5, samples=400] {f(x)};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

For shoved graph you only need to replace declare function = ... with function which you like to show.

Not the answer you're looking for? Browse other questions tagged or ask your own question.