我写了这段代码:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{axis}
\draw[->,thick] (-0.5,0) -- ++(11,0) node[below left]{$t$};
\draw[->,thick] (0,-0.5) -- ++(0,7) node[below right]{$s(t)$};
\end{axis}
\addplot{
[domain=0:2*pi,samples=40,smooth,
thick,blue]
{sin(deg(x))};}
\end{document}
当我运行此代码时,出现此错误:未定义的控制序列。
答案1
您应该检查pgfplots 手册:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\draw[->,thick] (-0.5,0) -- ++(11,0) node[below left]{$t$};
\draw[->,thick] (0,-0.5) -- ++(0,7) node[below right]{$s(t)$};
\addplot[domain=0:2*pi,samples=40,smooth, thick,blue]{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}