我正在尝试绘制以下函数的图形:
y = 0.00001096897 + 0.0003330018 * e ^ (−2.521376 * x)
但是,我不断收到错误消息:
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)').
以下是我的 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}
任何帮助,将不胜感激。
答案1
查找非 ASCII 字符是最难的部分。如果你有这些字符,你可以使用 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}