\documentclass[border=5mm,tikz]{standalone}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[scale=.7]
\draw[decoration={aspect=0.3, segment length=1.70553mm, amplitude=2.45113mm, coil},decorate] (0,0) -- (2,0);
\draw[fill=blue](2.1,-.5) rectangle (3.2,.5);
\draw(2,0)--(2.1,0);
\draw[fill=gray](-2,-.5)rectangle (-.20,1);
\draw(-.2,0)--(0,0);
\draw[dashed](3.2,0)--(9,0);
\draw[fill=gray](10,0) circle(5pt);
\draw(10,1) node {$P$};
\end{tikzpicture}
\end{document}
答案1
Sigur 建议的替代方法是绘制三角函数(使得切线匹配)。
\documentclass[border=5mm,tikz]{standalone}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[scale=.7]
\draw[decoration={aspect=0.3, segment length=1.70553mm, amplitude=2.45113mm, coil},decorate] (0,0) -- (2,0);
\draw[fill=blue](2.1,-.5) rectangle (3.2,.5);
\draw(2,0)--(2.1,0);
\draw[fill=gray](-2,-.5)rectangle (-.20,1);
\draw(-.2,0)--(0,0);
\draw[dashed](3.2,0)--(9,0);
\draw[fill=gray](10,0) circle(5pt);
\draw(10,1) node {$P$};
\draw plot[variable=\x,domain=4:8,samples=51,smooth]({\x},{cos(90*(\x-4))-1.5});
\draw[dashed] (3.2,-0.5) -- (4,-0.5) (8,-0.5) -- (10,-0.5) (6,-2.5) -- (10,-2.5);
\draw[thick,latex-latex] (9,-2.5) -- (9,-0.5) node[midway,right]{$H$};
\end{tikzpicture}
\end{document}