我在绘图时遇到错误

我在绘图时遇到错误
\documentclass[border=5pt,tikz,12pt]{article}
\usepackage[margin=0.75in,footskip=0.25in]{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.72]
\begin{axis}[
    ylabel = {When $y_0=10$},
    xmin = -1, xmax = 5,
    ymin = -1, ymax = 8,
    xtick distance = 1,
    ytick distance = 1,
    grid = both,
    axis lines = center,
    minor tick num = 1,
    major grid style = {lightgray},
    minor grid style = {lightgray!25},
    width = \textwidth,
    height = 0.5\textwidth]
    \addplot[
        domain = -0.4:8,
        samples = 100,
        smooth,
        thick,
        red,
    ] {5+5*\exp{-x}};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

您好,我在编译时遇到错误,错误发生在函数部分。我尝试了“x”和“\x”。

答案1

如果你写的话就不会有错误{5+5*exp(-x)}

相关内容