我尝试绘制 sin(100x) 和类似的高频 sinx 图;但图看起来不像那样。有人能帮帮我吗?
\documentclass{article}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{adjustbox}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.4\textwidth}
\begin{tikzpicture}
\begin{axis}[domain=0:1]
\addplot {sin(10*deg(x))};
\addplot {sin(25*deg(x))};
\addplot {sin(50*deg(x))};
\legend{$\sin(10x)$,$\sin(25x)$,$\sin(50x)$}
\end{axis}
\end{tikzpicture}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.4\textwidth}
\begin{tikzpicture}
\begin{axis}[domain=0:1]
\addplot {sin(100*deg(x))};
\addplot {sin(150*deg(x))};
\addplot {sin(200*deg(x))};
\legend{$\sin(100x)$,$\sin(150x)$,$\sin(200x)$}
\end{axis}
\end{tikzpicture}
\end{subfigure}
\caption{lajsdfls}
\end{figure}
\end{document}
答案1
像这样?
您的 MWE 与以下建议的解决方案之间的主要差异在代码中用以下代码标记% <---
:
\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
trig format=rad, % <---
domain=0:1, % <---
samples=501, % <---
no marks, % <---
%
legend style={font=\footnotesize,
cells={anchor=west}}
]
\addplot {sin(10*x};
\addplot {sin(25*x)};
\addplot {sin(50*x)};
\legend{$\sin(10x)$,$\sin(25x)$,$\sin(50x)$}
\end{axis}
\end{tikzpicture}
\end{document}