Вы находитесь на странице: 1из 19

ME 201/MTH 281

Guitar Modes
Mathematica 7

1. Introduction
In class we looked at the motion produced in a stretched string of length L, by displacing it from equilib-
rium and releasing it from rest. The displacement is produced by pulling the string upward a distance d at the
point x0 in the interval [0,L]. We define the piecewise linear displacement dis[x,x0 ], and then define a function
initgraph[x0 ] which gives a graph of the initial displacement for excitation at x0 . The vertical scale is greatly
exaggerated by choosing d = 0.5L. In the motion of a real guitar string, the vertical displacements are very small
compared with the string length.

dis[x_,x0_] := If[(x <= x0),d*x/x0,d*(L - x)/(L-x0)]

initgraph[x0_]:= Plot[dis[x,x0],{x,0,L},AspectRatio -> 0.2,ImageSize->250,


PlotLabel -> Row[{"Excitation at x0 = ",x0}]];
For simplicity in this part of the notebook, we choose the length to be 1 m and the wave speed to be 1
m/s. These choices have no significant effect on the visualization of the modes excited by the excitation. In the
last part of the notebook, where we produce the sounds associated with the vibration, we will use realistic values
of the parameters.
2 guitar.nb

For simplicity in this part of the notebook, we choose the length to be 1 m and the wave speed to be 1
m/s. These choices have no significant effect on the visualization of the modes excited by the excitation. In the
last part of the notebook, where we produce the sounds associated with the vibration, we will use realistic values
of the parameters.

L = 1.0 H** m **L;

d = 0.5 * L;

c = 1.0 H** ms **L;


In the examples of sections 2 and 3, we look at the cases of midpoint excitation and excitation at the 0.95L, very
near the bridge of the guitar.
The intial-value problem for the displacement y(x,t) is given below.

2 y 2 y
= c2 , 0 < x < L, t > 0
t2 x2
(1)
y
with y H0, tL = 0, y HL, tL = 0, y Hx, 0L = dis@x, x0 D, Hx, 0L = 0.
t
We showed in class that the solution to this problem is given by

npx
y Hx, tL = An cos Hn w1 tL sin O,
n=1 L
(2)
cp 2 Hd LL2 sin Hnpx0 LL
where w1 = , and An = .
L x0 H1 - x0 L n2 p2
Following our discussion in class, we examine the amplitudes of the modes relative to the first mode. We use
lower case a for these normalized amplitudes:

An sin Hnpx0 LL
an = = . (3)
A1 n2 sin Hpx0 LL
We define this function for Mathematica.

Sin@n * p * x0 LD
a@n_D :=
n2 * Sin@p * x0 LD
We will use these normalized amplitudes in producing both sounds and graphs.

The complete nth mode in this normalization is given by the function m[x,t,n], defined by

m@x_, t_, n_D := N@a@nD * Cos@Hn * p * c * tL LD * Sin@Hn * p * xL LDD


The function modearray[t,r], defined below, produces a table of graphs of the first r modes at time t. This
function is suitable for use in a GraphicsArray plot.

modearray[t_,r_] := Module[{n},Table[Plot[m[x,t,n],{x,0,L},
Axes -> False, Frame -> True,
PlotRange->{-1,1},FrameTicks -> None,
DisplayFunction -> Identity,
PlotLabel -> Row[{"n = ",PaddedForm[n,2]}]
],{n,1,r}]]
Finally the function makearray[p] produces a sequence of p arrays going through one period of the fundamental.
When animated, the sequence shows the modes dynamically.
guitar.nb 3

Finally the function makearray[p] produces a sequence of p arrays going through one period of the fundamental.
When animated, the sequence shows the modes dynamically.

makearray@p_D := Module@8n<, Do@Print@Show@


GraphicsGrid@Partition@modearray@HH2. * n * LL Hp * cLL, 6D, 3DD,
ImageSize 400, PlotLabel Row@8"t = ",
PaddedForm@HH2 n LL Hp cLL, 85, 3<D<DDD, 8n, 0, p - 1<DD;
Now we look at two examples.

2. Mid-Point Excitation
We set x0 = 0.5L. A graph of the displacement is given below.

x0 = 0.5 * L;

initgraph@x0D

Excitation at x0 = 0.5
0.5
0.4
0.3
0.2
0.1

0.0 0.2 0.4 0.6 0.8 1.0

Let's look at a table of values for the amplitudes a[n], for the first 10 modes.

TableFormA
TableA9n, PaddedFormAIfAIAbs@a@nDD < 10-4 M, 0, a@nDE, 85, 3<E=,
8n, 1, 10<E, TableHeadings 8None, 8"n", " a@nD"<<E

n a@nD
1 1.000
2 0.000
3 -0.111
4 0.000
5 0.040
6 0.000
7 -0.020
8 0.000
9 0.012
10 0.000

We see several interesting things from this table. First, the even harmonics are absent. This is a symme-
try result. The excitation is symmetric about the string midpoint, but the even harmonics are anti-symmetric
about the midpoint, hence they are absent. Second we see that the amplitude of the fundamental is much larger
than the other odd harmonics present. Thus we come reasonably close to exciting a pure single frequency tone
with this excitation.
Now we construct construct an array with 48 time increments per period. When you animate the array,
you will see a movie of the first six modes. The even modes (2,4,6) are absent, and the first mode has a much
greater amplitude than modes 3 or 5. We group all of the graphs in the sequence into the first cell, so that only
the first array is visible. To animate the sequence, select the graphs and go to the menu Graphics->Rendering-
>Animate Selected Graphics.
4 guitar.nb

Now we construct construct an array with 48 time increments per period. When you animate the array,
you will see a movie of the first six modes. The even modes (2,4,6) are absent, and the first mode has a much
greater amplitude than modes 3 or 5. We group all of the graphs in the sequence into the first cell, so that only
the first array is visible. To animate the sequence, select the graphs and go to the menu Graphics->Rendering-
>Animate Selected Graphics.

x0 = 0.5 * L;

makearray@48D;

t = 0.000
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

For visualization in the printed version of this notebook, we make a short sequence of 8 graph arrays in
one period.

makearray@8D

t = 0.000
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6
guitar.nb 5

t = 0.250
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 0.500
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 0.750
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6
6 guitar.nb

t = 1.000
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 1.250
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 1.500
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6
guitar.nb 7

t = 1.750
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

3. Excitation Very Near the Bridge


Now we repeat the above graphics construction, but this time for an x0 = 0.95, very near the end of the
string. The displacement is shown below.

x0 = 0.95 * L;

initgraph@x0D

Excitation at x0 = 0.95
0.5
0.4
0.3
0.2
0.1

0.0 0.2 0.4 0.6 0.8 1.0

Let's look at a table of values for the amplitudes a[n], for the first 10 modes.
8 guitar.nb

TableFormA
TableA9n, PaddedFormAIfAIAbs@a@nDD < 10-4 M, 0, a@nDE, 85, 3<E=,
8n, 1, 10<E, TableHeadings 8None, 8"n", " a@nD"<<E

n a@nD
1 1.000
2 -0.494
3 0.322
4 -0.235
5 0.181
6 -0.144
7 0.116
8 -0.095
9 0.078
10 -0.064

There is no longer the symmetry that we had with midpoint excitiation, and all the modes are present. Further-
more, the amplitudes of the first few higher harmonics are appreciable, and this excitation will give a different
sound (as we will see in section 5 of this notebook).
Now we construct construct an array with 48 time increments per period. When you animate the array,
you will see a movie of the first six modes.

makearray@48D;

t = 0.000
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

There is much more energy in the higher modes for this case than for the midpoint excitation. This accounts for
the harsh tinny sound of a guitar string plucked near the bridge.
For visualization in the printed version of this notebook, we construct a short sequence of 8 graph arrays
in a period.

makearray@8D;
guitar.nb 9

t = 0.000
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 0.250
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 0.500
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6
10 guitar.nb

t = 0.750
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 1.000
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 1.250
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6
guitar.nb 11

t = 1.500
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

t = 1.750
n = 1 n = 2 n = 3

n = 4 n = 5 n = 6

4. Modal Energy
As shown in class, the solution given by equation (2) has a constant energy E, given by

E = 2 2 2
n= 1 En , where En = (Tp n An )/(4L) . (4)
En is the energy in the nth mode and is also constant. We will work with the energy in the nth mode relative to
the energy in the first mode, given by

2
En sin Hnpx0 L
en = = n2 a2n = . (5)
E1 n sin Hpx0 L
In this section we show the normalized energy of the first ten harmonics as a function of the excitation point x0 .
We us bar graphs to show the energy. In version 7 of Mathematica, the bar graph routines are part of the kernel,
and do not eed to be loaded in
The function e[n,x0] gives the normalized energy in the nth mode for an excitation point x0.

e[n_,x0_] := N[(Sin[n*p*x0])^2/(n*n*(Sin[p*x0])^2)]
The function harmlist[x0,j] produces a list suitable for a bar plot, showing the energy for the first j harmonics
when the excitation point is x0 .
12 guitar.nb

The function harmlist[x0,j] produces a list suitable for a bar plot, showing the energy for the first j harmonics
when the excitation point is x0 .

harmlist[x0_,j_] := Module[{ans}, ans = {};


Do[ans = Append[ans,e[k,x0]],{k,1,j}]; ans]
The function harmonic[x0,n] produces the bar chart of the energy for the first n harmonics when the excitation
point is x0 .

harmonic[x0_,n_] := BarChart[harmlist[x0,n],
PlotRange -> {{0,n+1},{0.0, 1.0}},
AxesLabel -> {"Harmonic","Energy"},ImageSize->400,
PlotLabel -> Row[{"x0 = ",PaddedForm[x0,{5,3}]}]]
We look first at the energy when the excitation point is the midpoint. We see that modes 2, 4, 6, 8, 10,...
are absent. We expect this because the excitation is symmetric about the midpoint and these modes are antisym-
metric about the midpoint. Similar symmetries show up at other values of x0 . In fact you can show that any
mode which has a node at x0 will have zero energy.

harmonic[0.5*L,10]

Now we make a systematic study of the effect of the excitation point by constructing a sequence of 100
graphs from x0 = 0.5 to x0 = 0.99. The 100 graphs are collected in the cell below. To animate them, select the
cell, and then go to the menu Graphics->Rendering->Animate Selected Graphics. From the animation of the
graph sequence, we see that the modal energies become asymptotically equal as we approach the bridge of the
guitar.

Do[Print[harmonic[0.5 + j*0.005,10]],{j,0,99}];
guitar.nb 13

For visualization in the printed version of this notebook, we construct a sequence of 10 energy graphs
with the excitation point varying from 0.5 to 0.95 in increments of 0.05.

Do[Print[harmonic[0.5 + j*0.05,10]],{j,0,9}]
14 guitar.nb
guitar.nb 15
16 guitar.nb
guitar.nb 17
18 guitar.nb

5. Hearing the Sounds


In this section, we use Mathematica to play the sounds produced by plucking the string. In particular, we
will see how the sound changes from midpoint excitation to excitation near the bridge. In the previous section,
we used convenient values for c and L because these values gave the same picture sequence as would have more
realistic values. For hearing the sounds, however, we have to use values that approximate the real ones for a
guitar. We will look at the high-E string of the guitar, which has a fundamental frequency of

n = 330.0 H** Hz **L;


The length of the string is

L = 0.65 H** m **L;


This corresponds to a wave speed of

c = 2 * L * n H** ms **L

429.

The nth harmonic is given by

tone@t_, n_D := N@a@nD * Cos@Hn * p * c * tL LDD


Now we set x 0 to the midpoint and then we play for five seconds the sound associated with the first six harmon-
ics. As we saw before, the amplitudes of the various harmonics (the a[n]'s) depend on the value of x0 .

x0 = 0.5 * L;
We call the sum of the first six harmonics midtone.
guitar.nb 19

midtone@t_D = Sum@tone@t, nD, 8n, 1, 6<D

1. Cos@2073.45 tD + 3.06162 10-17 Cos@4146.9 tD -


0.111111 Cos@6220.35 tD - 1.53081 10-17 Cos@8293.8 tD +
0.04 Cos@10 367.3 tD + 1.02054 10-17 Cos@12 440.7 tD

Now we create midtone. To play it, click on the small triangle at the lower left.

sound1 = Play@midtone@tD, 8t, 0, 5<D

Now we set x0 to 0.95*L corresponding to a position very near the bridge. We call the sum of the first 6 harmon-
ics bridgetone.

x0 = 0.95 * L;

bridgetone@t_D = Sum@tone@t, nD, 8n, 1, 6<D

1. Cos@2073.45 tD - 0.493844 Cos@4146.9 tD +


0.322457 Cos@6220.35 tD - 0.234837 Cos@8293.8 tD +
0.180806 Cos@10 367.3 tD - 0.143656 Cos@12 440.7 tD

Now we create bridgetone. Click on the triangle to play it.

sound2 = Play@bridgetone@tD, 8t, 0, 5<D

Bridgetone is clearly tinny and much harsher than midtone. Neither tone sounds like a guitar, and you might
want to think about the many reasons for that.

Вам также может понравиться