我嘗試繪製 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}