Guitar strings and fret positions ed

Problem: the 12th fret is out of tune when put into the perfect center of a string! Usually bridges are adjustable to make higher strings shorter.

Why? And how to solve this more correctly?

String description ed

Setup ed

We describe small movements of a string in a single plane by the function \(y(x)\)

Stretching ed

Our model ignores longitudinal waves! The string can only be stretched along the y-axis if \(y' \neq 0\):

Looking at a small piece \(dx\) and stretching to \(dx + \delta x\), by Hooke's law, we need the force \(F = k \, \delta x\) with \(k = E \, A\). Here \(E\) is Young's modulus, a material constant and about \(100GPa\) for steel. \(A=\pi r^2\) is the cross section area. We will also add \(F_0\), the force/tensionat rest from tuning the string.

Since string movement is small, we approximate \(\delta x\) by\[ \delta x = \left(\sqrt{1 + (y')^2} - 1\right) \, dx \approx \frac{(y')^2}{2} \,dx \]and the energy per piece is\[ dE_{\mathrm{stretch}} = \underbrace{\frac{E\,A}{8} \, (y')^4 \, dx}_{\mathrm{ignore}} + F_0 \frac{(y')^2}{2}\,dx \, . \]

Bending ed

Bending is more complicated. The curvature of the string is \(y''\) (as long as we only allow small movements). The resistance to bending is \(E\,I\). \(E\) is again Young's modulus (for most materials) and \(I=\frac{\pi}{4} r^4\) is the second moment of area.

The energy for a small piece is\[ dE_{\mathrm{bend}} = \frac{E\,I}{2} (y'')^2 \, dx \, . \]

String motion ed

Equations of motion ed

Inspired by https://en.wikipedia.org/wiki/Euler–Bernoulli_beam_theory

We can find the equations of motion from the action, i.e. the integral over "kinetic energy minus potential energy":\[ S = \int dt \int_0^L dx \left[ \frac{\mu}{2} (\dot y)^2 - \frac{E \, I}{2} (y'')^2 - \frac{F_0}{2} (y')^2 \right] = \iint \mathcal{L} \]

The first term is the kinetic energy with \(\mu = \rho \, A = \rho \, \pi \, r^2\) the mass per unit length.

Euler-Lagrange gives us differential equations:\[ 0 = \frac{\partial \mathcal L}{\partial y} - \frac{\partial}{\partial t}\frac{\partial \mathcal L}{\partial \dot y} - \frac{\partial}{\partial x}\frac{\partial \mathcal L}{\partial y'} + \frac{\partial^2}{\partial x^2}\frac{\partial \mathcal L}{\partial y''} \]or\[ 0 = - \mu \, \ddot y + F_0 \, y'' - E \, I \, y'''' \, . \]

Before we solve this mess, let's look at the simpler version without bending!

No bending term ed

\[ 0 = - \mu \, \ddot y + F_0 \, y'' \]We're looking for eigen-frequencies, using the Ansatz\[ y(x,t) = \hat y(x) \, \cos \omega t \, . \]Now, the \(t\)-dependency splits off, leaving\[ 0 = \mu \, \omega^2 \, \hat y + F_0 \, \hat y'' \, . \]

The books about linear differential equations tell us to insert \(e^{\beta x}\) and solve for \(\beta\):\[ 0 = \mu \, \omega^2 + F_0 \, \beta^2, \quad \Rightarrow \quad \beta = \pm i \sqrt{\frac{\mu \, \omega^2}{F_0}} \]The only real solution with \(\hat y(0)=0\) is \( \hat y = \sin(|\beta| x) \). From the boundary condition at \(x=L\), we can find the allowed frequencies:\[ |\beta_n| L = \sqrt{\frac{\mu \, \omega_n^2}{F_0}} L = n \, \pi \quad \Rightarrow \quad \boxed{ \omega_n = \frac{n \, \pi}{L} \sqrt{\frac{F_0}{\mu}} } \]

With bending ed

Again we split off time:\[ 0 = \mu \, \omega^2 \, \hat y + F_0 \, \hat y'' - E\,I\,\hat y'''' \]Inserting \(e^{\beta x}\) and solving for \(\beta^2\) gives\[ \beta^2 = \frac{F_0 \pm \sqrt{{F_0}^2 + 4 \mu\,\omega^2\,E\,I}}{2 E\,I} \label{eq:beta-exact} \]with \({\beta_+}^2 \gt 0 \Rightarrow \beta_+ \in \mathbb R\) and \({\beta_-}^2 \lt 0 \Rightarrow \beta_- \in i \mathbb R\). The 4 basic solutions correspond to\[ \cosh(\beta_+ x), \quad \sinh(\beta_+ x), \quad \cos(|\beta_-| x), \quad \sin(|\beta_-| x) \, . \]

With the boundary conditions \(\hat y(0) = \hat y(L) = 0\), we'll pick the \(\sin\).

For the fundamental mode, we get \(\sin(|\beta_-| L) = 0 \Rightarrow |\beta_-| L = \pi\).

Improvement
The term \(E\,I\) is very small! Eq. \ref{eq:beta-exact} will be numerically unstable. Instead, we can approximate the solution of a polynomial \(a\,x^2 + b\, x + c = 0\) by first choosing \(x_0 = -\frac{c}{b}\), the solution if \(a=0\), and then adding a correction term.

Inserting \(x=x_0 + \delta x\) back in and cutting off any \(\delta x^2\) terms gives us\[ x \approx -\frac{c}{b} -a\frac{c^2}{b^3} \, . \]

Frequency

\[ |\beta|^2 \approx \frac{\mu \, \omega^2}{F_0} + E\,I\,\frac{\mu^2\,\omega^4}{{F_0}^3} \]We want to solve \(|\beta|^2 \, L^2 = \pi^2\) for \(\omega^2\). Again, we have a quadratic equation with the leading term close to \(0\):\[ \omega^2 \approx \frac{\pi^2 \, F_0}{L^2 \, \mu} - \frac{E\,I\,L^2\,\mu^2}{{F_0}^3} \frac{\pi^4 \, {F_0}^2}{L^4\,\mu^2} \]or\[ \boxed{ \omega^2 \approx {\omega_0}^2 + E\,I\, \frac{\pi^4}{F_0\,L^2} } \]with \(\omega_0\) from the non-bending case.

Categories: Blog, Audio programming