\documentclass[10pt, oneside]{article}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}
\begin{document}
\begin{tikzpicture}[scale=0.75]
\begin{axis}[
axis lines = left,
ymax=1,
ymin=0,
xlabel = \( x \),
ylabel = {\( f(x) \)},
xtick={0,1},
xticklabels={$0$,$1$},
ytick={0,1},
yticklabels={$0$,$1$},
]
\addplot[domain=0:1, samples = 500, color=red, style=very thick] {(2 / pi)*asin(sqrt(x)) };
\end{axis}
\end{tikzpicture}
\end{document}
这是什么原因造成的?该如何解决?
答案1
您可能错误地认为三角函数默认以弧度为单位。
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=left,
ymin=0, ymax=1,
xlabel=\(x\),
ylabel={\(f(x)\)},
xtick={0,1}, ytick={0,1},
trig format plots=rad,
]
\addplot[red, very thick, domain=0:1, samples=200, smooth] {(2/pi)*asin(sqrt(x))};
\end{axis}
\end{tikzpicture}
\end{document}