我怎样才能绘制如下函数: https://www.math24.net/wp-content/uploads/2018/10/increasing-function.svg https://www.math24.net/wp-content/uploads/2018/10/decreasing-function.svg
我知道绘制特定函数的以下方法:
\begin{figure}[H]
\centering
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\begin{axis}[
x=0.5cm,y=0.5cm,
ticks=none,
axis lines=middle,
xmin=-1.080000000000009,
xmax=5.919999999999983,
ymin=-1.199999999999982,
ymax=3.1000000000000054,
ylabel={$y$},
xlabel={$x$},]
\clip(-1.08,-2.02) rectangle (5.92,3.1);
\draw[line width=1pt, smooth,samples=100,domain=-0.780000000000009:5.119999999999983] plot(\x,{sin(((\x))*180/pi)+0.3});
\end{axis}
\end{tikzpicture}
\end{figure}
但是,我找不到图片中显示的函数公式。有没有什么办法可以绘制出像图片中一样的递增函数(但不是严格递增)?另外,我希望图表的样式与上面代码中的样式一样,因为我需要它用于文章,并且我应该在整篇文章中保持相同的样式。提前致谢!
答案1
像这样吗?
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[->] (-1,0) -- (4,0) node[below left] {$x$};
\draw[->] (0,-1) -- (0,4) node[below left] {$y$};
\draw[thick,blue!80!black]
(-0.5,0.5) to[out=45,in=180] (1,1) to[out=0,in=180]
node[midway,above left] (f){$y=f(x)$}(2.5,3) -- (3.5,3);
\path (0,0) node[below left] {$0$} (f)
node[above=2em,font=\sffamily,align=center] {increasing\\ function};
\end{tikzpicture}
\end{document}