
しかし、私のコードは単純に動作しません
\begin{tikzpicture}
\begin{axis}[
width=18cm,
axis lines=middle,
xmin=0,xmax=1.02,
ymin=0.86,ymax=1.02,,
xlabel=\Large $c$,ylabel=\Large $F_g$,
xtick={0.2,0.4,0.6,0.8,1.0},
ytick={0.88,0.94,0.98,1},
]
\addplot[blue,samples=800,domain=0:1,smooth] {0.25*((sqrt{(1+(\x))*(1+ (sqrt{\x}))}) + (sqrt{((1+(\x))*(1+(sqrt{\x})))}))^2};
\end{axis}
\end{tikzpicture}
誰かこれを手伝ってくれませんか。(1+\x) のようなものをプロットすると、うまくいかないので、これは小さな問題だと思います。したがって、(f(\x) + g(\x))^2 のようなものは決して機能しません。タイプミスでしょうか、それとももっと良い方法があるのでしょうか?
答え1
間違った関数を入力しました (+
どちらの場合も、 を入力する必要があります-
)。また、 を入力する必要もありませsqrt(x)
んsqrt{x}
。
他にも間違っているところがありますが、最初から書き直しました。
\addplot[blue,samples=80,domain=0:1,smooth] {0.25*(sqrt((1-x)*(1-sqrt(x))) + sqrt((1+x)*(1+sqrt(x))))^2};
軸の制限と目盛りラベルを少し変更した完全なコード:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=18cm,
axis lines=middle,
xmin=0,xmax=1.02,
ymin=0.98,ymax=1.01,
xlabel=\Large $c$,ylabel=\Large $F_g$,
xtick={0.2,0.4,0.6,0.8,1.0},
ytick={0.98,0.985,...,1.01},
yticklabel style={
/pgf/number format/fixed zerofill,
/pgf/number format/precision=3,
}
]
\addplot[blue,samples=80,domain=0:1,smooth] {0.25*(sqrt((1-x)*(1-sqrt(x))) + sqrt((1+x)*(1+sqrt(x))))^2};
\end{axis}
\end{tikzpicture}
\end{document}