3

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

2

1 Answer 1

3

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

Code:

\documentclass{article}

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

\pgfmathdeclarefunction{Function}{1}{%
  \pgfmathparse{300 + 1000/x + 2.5}%
}

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

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

You must log in to answer this question.

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