I have the following tikz code which I based on https://tex.stackexchange.com/a/13952/15360. Now I want to have the spring, the damper and the 3 arrows have labels. Like for example, F for force and k as spring constant, and d as damper constant.
Do I have to use fixed coordinates? \node[draw] at (0,0) {$F$};?
Or can I do this more clever? Because at the moment the spring is not a node so I have no coordinates of it...
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}
\begin{document}
\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post
length=0.3cm,segment length=6}]
\tikzstyle{damper}=[thick,decoration={markings,
mark connection node=dmp,
mark=at position 0.5 with
{
\node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum
width=15pt,minimum height=3pt,draw=none] {};
\draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south
west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}
}, decorate]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm]
\node (M1) [minimum width=1.5cm, minimum height=1.5cm] {$m_1$};
\node (M2) at (3,0) [minimum width=1.5cm, minimum height=1.5cm] {$m_2$};
\draw[spring] ($(M1.east) - (0,0.5)$) -- ($(M2.west) - (0,0.5)$);
\draw[damper] ($(M1.east) + (0,0.5)$) -- ($(M2.west) + (0,0.5)$);
\draw[thick, dashed] ($(M1.north west)$) -- ($(M1.north west) + (0,1)$);
\draw[thick, dashed] ($(M2.north west)$) -- ($(M2.north west) + (0,1)$);
\draw[ultra thick, -latex] ($(M2.north west) + (0,0.75)$) --
($(M2.north west) + (1,0.75)$);
\draw[ultra thick, -latex] ($(M1.north west) + (0,0.75)$) --
($(M1.north west) + (1,0.75)$);
\draw[ultra thick, -latex] ($(M1.west) - (1,0)$) -- ($(M1.west)$);
\end{tikzpicture}
\end{document}
.