%20%3D%20-y(x))%20%E3%82%92%E8%BF%BD%E5%8A%A0%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%20.png)
tikzplot を使用して描画したい反対称データがあります。正の x 軸のデータを使用して、データの反対称部分 (y(-x) = -y(x)) を追加したいと思います。
答え1
この例では、青い曲線は元の関数 y(x) を表し、赤い曲線は反対称部分 y(-x) = -y(x) を表します。オプションはdomain
プロットする x 値の範囲を指定し、データセットに基づいて調整できます。
この方法を使用すると、x 軸の正の側のみをプロットし、曲線を反射して反対称部分を自動的に生成できます。
\documentclass[tikz, border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel={$x$},
ylabel={$y$},
axis lines=middle,
domain=0:5, % adjust the domain as needed
samples=100,
legend pos=outer north east,
]
% Define your function y(x)
\addplot[blue, mark=none, domain=0:5] {sin(deg(x))};
% Define the antisymmetric part y(-x) = -y(x)
\addplot[red, mark=none, domain=0:5] {-sin(deg(x))};
\legend{$y(x)$, $y(-x)$}
\end{axis}
\end{tikzpicture}
\end{document}