Study the Vibrations of a Stretched String
Study the vibrations of a stretched string using the wave equation.
In[1]:=
weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];
Specify that the ends of the string remain fixed during the vibrations.
In[2]:=
bc = {u[0, t] == 0, u[\[Pi], t] == 0};
Give initial values at different points on the string.
In[3]:=
ic = {u[x, 0] == x^2 (\[Pi] - x),
\!\(\*SuperscriptBox[\(u\),
TagBox[
RowBox[{"(",
RowBox[{"0", ",", "1"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, 0] == 0};
Solve the initial-boundary value problem.
In[4]:=
dsol = DSolve[{weqn, bc, ic}, u, {x, t}] /. {K[1] -> m}
Out[4]=
Extract four terms from the Inactive sum.
In[5]:=
asol[x_, t_] = u[x, t] /. dsol[[1]] /. {\[Infinity] -> 4} // Activate
Out[5]=
Each term in the sum represents a standing wave.
In[6]:=
Table[Show[
Plot[Table[asol[x, t][[m]], {t, 0, 4}] // Evaluate, {x, 0, Pi},
Ticks -> False], ImageSize -> 150], {m, 4}]
Out[6]=
Visualize the vibration of the string.
In[7]:=
Animate[Plot[asol[x, t], {x, 0, \[Pi]}, PlotRange -> {-5, 5},
ImageSize -> Medium, PlotStyle -> Red], {t, 0, 2 Pi},
SaveDefinitions -> True]