0

I'm attempting to graph the following function:

y = 0.00001096897 + 0.0003330018 * e ^ (−2.521376 * x)

However, I keep getting the error message:

 Package PGF Math Error: Could not parse input '' as a floating point number, sorry. The unreadable part was near ''. (in '0.00001096897 + 0.0003330018 * 2.718 ^ (−2.521376 * x)').

Below is my MWE:

\documentclass[12pt]{article}

\usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{tikz} \usepackage{graphicx} \usepackage{siunitx}

\begin{document}

\begin{figure}[h!] \centering \begin{tikzpicture} \begin{axis}[
    width=\textwidth,
    height = 20em,
    draw = none]
    \addplot[blue, smooth]{0.00001096897 + 0.0003330018 * 2.718 ^ (−2.521376 * x)}; \end{axis} \end{tikzpicture} \label{fig:repeatgraph} \end{figure}

\end{document}

Any help would be appreciated.

9
  • You have nonstandard characters in your code.
    – user121799
    Jul 2, 2019 at 5:21
  • 1
    The minus in front of 2.521376 is not a standard minus. Replace it by a real minus. You can also use 0.00001096897 + 0.0003330018 * exp (-2.521376 * x). Copy this literally, without replacing the minus by a nonstandard character.
    – user121799
    Jul 2, 2019 at 5:24
  • 2
    In laymans terms, use ascii chars for this. The minus is probably a unicode char which is not handled by the pgf math engine
    – daleif
    Jul 2, 2019 at 5:56
  • 1
    @Raaja a lot of people does not know what "nonstandard characters" mean. Just see all those examples with invisible unicode chars that no-one knows where came from
    – daleif
    Jul 2, 2019 at 7:53
  • 1
    @Raaja try looking up the unicode char greek question mark, then consider all the programming languages that uses the similar ascii char.
    – daleif
    Jul 2, 2019 at 9:31

1 Answer 1

1

Finding the non-ascii characters is the hard part. If you have them, you can (re)define them using DeclareUnicodeCharacter:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{siunitx}

\DeclareUnicodeCharacter{2212}{-}

\begin{document}

\begin{figure}[h!]
  \centering
   \begin{tikzpicture} \begin{axis}[
      width=\textwidth,
      height = 20em,
      draw = none]
    \addplot[blue, smooth]{0.00001096897 + 0.0003330018 * 2.718 ^ (−2.521376 * x)}; \end{axis} \end{tikzpicture} \label{fig:repeatgraph}
 \end{figure}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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