Help! How to draw the plot of y=(ax+b)/(cx+d) and give an example!

I find in pst-plot.pdf, pst-func.pdf document but there is no its tutorial. So I hope anyone help me to draw the plot of it.(its code :-)) ). Thanks.

Example: y=(x-2)/(2x+1) Can anyone draw it by Pstricks environment?

• Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far. – albert Nov 17 '18 at 14:41
• Sorry, i don't know its code so i hope anyone know about it to help me. – user173875 Nov 17 '18 at 14:47
• Vietnamese TikZ tutorial: Link – user156344 Nov 17 '18 at 15:01
• There is no the plot of functions y=(ax+b)/(cx+d). :)) – user173875 Nov 17 '18 at 15:07

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{center}
\begin{tikzpicture}[scale=2]
\begin{axis}[axis lines=middle]
\draw[blue] (axis cs:-0.5,-6)--(axis cs:-0.5,6)
(axis cs:-4,0.5)--(axis cs:4,0.5);
\fill[red] (axis cs:-0.5,0.5) circle(1mm);
\end{axis}
\end{tikzpicture}
\end{center}
\end{document} • @TrongVuong If you agree with this answer, then you accept it and vote for answer. – minhthien_2016 Nov 17 '18 at 15:58
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}

\begin{document}
\begin{pspicture}[algebraic](-6,-6)(6,6)
\psaxes{->}(0,0)(-5.5,-5.5)(5.5,5.5)[$x$,0][$y$,90]
\psline[linecolor=red,linewidth=0.2pt](-0.5,-5.5)(-0.5,5.5)
\psline[linecolor=red,linewidth=0.2pt](-5.5,0.5)(5.5,0.5)
\psplot[plotpoints=1001,linecolor=blue,linewidth=2pt,
yMaxValue=5.25]{-5.5}{5}{(x-2)/(2*x+1)}
\psdots[linecolor=red](-0.5,0.5)(0,0)(0,-2)(1,0)(2,0)
\end{pspicture}
\end{document} A PSTricks answer for the PSTricks question.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\def\f{(x-2)/(2*x+1)}

\begin{document}
\begin{pspicture}[algebraic](-4,-4)(6,5.5)
\psaxes{->}(0,0)(-4,-4)(5.5,5)[$x$,0][$y$,90]
\psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
\psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
\psset{linecolor=blue,linewidth=2pt}
\psplot{-4}{-7 9 div}{\f}
\psplot{-2 9 div}{5}{\f}
\end{pspicture}
\end{document} NOTE

Increasing plotpoints sometimes is not a wise method because it will increase the size of its output (either PDF or SVG).

More flexible solution

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\def\f(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
\def\g(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

\pstVerb{/I2P {AlgParser cvx exec} def}% infix to postfix operator

\begin{document}
\begin{pspicture}[algebraic](-4,-4)(6,6)
\psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
\psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
\psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
\psset{linecolor=blue,linewidth=2pt}
\psplot{-4}{\g(5) I2P}{\f(x)}
\psplot{\g(-4) I2P}{5}{\f(x)}
\end{pspicture}
\end{document}