我对 tikzpicture 中的这个情节有疑问。
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.5}
\begin{document}
\begin{center}
\scalebox{2.00}{
\begin{tikzpicture}
[
declare function={
func(\x)= (\x >= 0, \x < sqrt(2)/2) * (-sqrt(1-pow(\x,2))+1) +
(\x >= sqrt(2)/2, \x < 4-sqrt(2)) * (\x-(sqrt(2)-1)) +
(\x >= 4-sqrt(2), \x < 4+sqrt(2)) * (sqrt(4-pow(\x-4,2))+0.758) +
(\x >= 4+sqrt(2), \x < 8-sqrt(2)/2) * (-\x+(9-sqrt(2))) +
(\x >= 8-sqrt(2)/2, \x <= 8) * (-sqrt(1-pow(\x-8,2))+1)
;
}
]
\begin{axis}[
samples = 100,
domain=0:8, xmax=8.5,
restrict y to domain=0:3.5,
axis lines=left,
y=0.5cm,
x=0.5cm,
grid=both,
xtick={0,...,8},
ytick={0,1,2,3},
compat=newest,
xlabel=Time (s), xlabel style={at={(1,0)}, anchor=west},
ylabel=Velocity (m/s), ylabel style={rotate=-90,at={(0,1)}, anchor=south}
]
\addplot [blue,thick] {func(x)};
\end{axis}
\end{tikzpicture}
}
\end{center}
\end{document}
但是,我希望情节看起来如下所示。我确信问题出在“声明函数”部分。非常感谢您的帮助。