I am new to LaTeX and I want to know how to plot the following function using TikZ:

y = 300 + 1000/x + 2.5x.

at the interval 0:250


1 Answer 1


Here is a version adapted from Easiest way to plot a function with PGF/TikZ.

One does not need to use \pgfmathdeclarefunction, but I find it easier to maintian code if each function is declared as such.

enter image description here



\usepackage{pgfplots}% This uses tikz
\pgfplotsset{compat=newest}% use newest version

  \pgfmathparse{300 + 1000/x + 2.5}%

\tikzset{My Line Style/.style={smooth, ultra thick, samples=400}}

\begin{axis}[unbounded coords=discard]
    \addplot[My Line Style, color=blue, domain=0:250] (\x,{Function(\x)});

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .