Some diagrams of basic physics problems involving masses and springs, hanging both horizontally and vertically, as well as a mass connected to two springs, to study Hooke’s law and simple harmonic oscillations.
For more related figures, please see the “forces” or “Newton’s laws” tag.
Horizontal spring
Vertical spring
Double spring
Edit and compile if you like:
% Author: Izaak Neutelings (September 2020)\documentclass[border=3pt,tikz]{standalone}\usepackage{physics}\usepackage{tikz}\usepackage[outline]{contour} % glow around text\usetikzlibrary{patterns,snakes}\usetikzlibrary{arrows.meta} % for arrow size\contourlength{0.4pt}\colorlet{xcol}{blue!70!black}\colorlet{darkblue}{blue!40!black}\colorlet{myred}{red!65!black}\tikzstyle{mydashed}=[xcol,dashed,line width=0.25,dash pattern=on 2.2pt off 2.2pt]\tikzstyle{axis}=[->,thick] %line width=0.6\tikzstyle{ell}=[{Latex[length=3.3,width=2.2]}-{Latex[length=3.3,width=2.2]},line width=0.3]\tikzstyle{dx}=[-{Latex[length=3.3,width=2.2]},darkblue,line width=0.3]\tikzstyle{ground}=[preaction={fill,top color=black!10,bottom color=black!5,shading angle=20},fill,pattern=north east lines,draw=none,minimum width=0.3,minimum height=0.6]\tikzstyle{mass}=[line width=0.6,red!30!black,fill=red!40!black!10,rounded corners=1,top color=red!40!black!20,bottom color=red!40!black!10,shading angle=20]\tikzstyle{spring}=[line width=0.8,blue!7!black!80,snake=coil,segment amplitude=5,segment length=5,line cap=round]\tikzset{>=latex} % for LaTeX arrow head\tikzstyle{force}=[->,myred,very thick,line cap=round]\def\tick#1#2{\draw[thick] (#1)++(#2:0.1) --++ (#2-180:0.2)}\begin{document}% HORIZONTAL spring\begin{tikzpicture}\def\H{1} % wall height\def\T{0.3} % wall thickness\def\W{2.6} % ground length\def\D{0.25} % ground depth\def\h{0.6} % mass height\def\w{0.7} % mass width\def\x{1.6} % mass x position\draw[spring] (0,\h/2) --++ (\x,0);\draw[ground] (0,0) |-++ (-\T,\H) |-++ (\T+\W,-\H-\D) -- (\W,0) -- cycle;\draw (0,\H) -- (0,0) -- (\W,0);\draw[mass] (\x,0) rectangle++ (\w,\h) node[midway] {$m$};
Click to download: dynamics_spring.tex • dynamics_spring.pdf
Open in Overleaf: dynamics_spring.tex