我想用指数函数 y=e^{x-1}; y=2-x 和 Ox 来填充积分极限。请大家帮忙]1
答案1
首先,您应该发布您尝试过的方法,然后发布您的问题。
\documentclass[a4paper, 12pt]{standalone}
\usepackage{fouriernc}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
axis lines = center,
axis line style = very thick,
xlabel=$x$, ylabel=$y$,
domain=-1:3,
ymin=-0.5,
ymax=2.5,
xmin=-1,
xmax=3,
xticklabels={},yticklabels={},
unit vector ratio*=1 1 1,
width=7cm,
grid=major,
grid style={gray!30}
]
\addplot [name path=A,blue, very thick,samples=100] {exp(x-1)};
\addplot [name path=B,thick] {2-x};
\addplot [name path=C] {0};
\node at (axis cs:-0.25, -0.25) {$O$} ;
\addplot [black, mark = *] coordinates {(1, 1)} ;
\addplot[pattern=north east lines] fill between[of=A and C,soft clip={domain=0:1}];
\addplot[pattern=north east lines] fill between[of=B and C,soft clip={domain=1:2}];
\addplot[color=blue,dashed] coordinates {
(0, 1)
(1, 1)
(1,0 )
};
\node at (axis cs:-0.2, 1) {$1$} ;
\node at (axis cs:1, -0.25) {$1$} ;
\end{axis}
\end{tikzpicture}
\end{document}