Superposition of Traveling Waves
Physics 151

Clear["Global`*"]

Two wave pulses traveling in opposite directions

p[x_, x0_] := 1/(1 + (x-x0)^2) (* A pulse centered at x0 *)
v = 2;
p1[x_, t_] :=    p[x - v t, -5]
p2[x_, t_] := -p[x + v t, 5]

Animate[Plot[p1[x, t], {x, -10, 10}, PlotStyle->Red, PlotRange -> {-1, 1}], {t, 0, 5}, AnimationRunning->False, DefaultDuration->5, ControlPlacement -> Top]

Animate[Plot[p2[x, t], {x, -10, 10}, PlotStyle->Blue, PlotRange -> {-1, 1}], {t, 0, 5}, AnimationRunning->False, DefaultDuration->5, ControlPlacement -> Top]

Animate[Plot[{
p1[x, t], p2[x, t],p1[x, t] + p2[x, t]}, {x, -10, 10}, PlotStyle->{Red, Blue, Black}, PlotRange -> {-1, 1}, ImageSize-> Scaled[0.8],PlotLabel->"Superposition"],{t, 0, 5}, AnimationRunning->False, DefaultDuration->15, ControlPlacement -> Top]

Animate[
Plot[p1[x, t] + p2[x, t], {x, -10, 10}, PlotStyle->Black, PlotRange->{-1.0,1.0}, ImageSize->Scaled[0.8], PlotLabel->"Resulting Wave"],{t, 0, 5}, AnimationRunning->False, DefaultDuration-> 10, ControlPlacement -> Top]

Two sine waves traveling to the right

Consider  some simple waves,  each of amplitude 1,  wavelength λ, and wave speed v.

y1[λ_, f_, x_,t_] := Sin[(2 π/λ) x - (2 π f) t]
y2[λ_, f_, x_,t_] := Sin[(2 π/λ) x - (2 π f) t + π/2] (* Add a phase to make it interesting *)

λ =10;
f = 4;
T = 1/f;
L = 8 * (λ/2);

Animate[Plot[y1[λ, f, x, t], {x, 0, L}, PlotStyle->Red], {t, 0, 5 * T}, AnimationRunning->False, DefaultDuration->5, ControlPlacement -> Top]

Animate[Plot[y2[λ, f, x, t], {x, 0,L}, PlotStyle->Blue], {t, 0, 5 * T}, AnimationRunning->False, DefaultDuration->5, ControlPlacement -> Top]

Animate[
Plot[{y1[λ, f, x, t], y2[λ, f, x, t], y1[λ, f, x, t] + y2[λ, f, x, t]}, {x,0,L}, PlotStyle->{Blue, Red, Black}, PlotRange->{-1.5,1.5}, ImageSize->Scaled[0.8],PlotLabel->"Superposition"],{t, 0, 5 * T}, AnimationRunning->False, DefaultDuration->15, ControlPlacement -> Top]

Animate[
Plot[y1[λ, f, x, t] + y2[λ, f, x, t], {x, 0, L}, PlotStyle->Black, PlotRange->{-1.5,1.5}, ImageSize->Scaled[0.8], PlotLabel->"Resulting Wave"],{t, 0, 5 * T}, AnimationRunning->False, DefaultDuration-> 10, ControlPlacement -> Top]

Left and Right-going waves

Assume the wave is confined to a length L.  To get standing waves, we will see that we need to have L = (integer) * (λ/2)

yr[λ_, f_, x_,t_] := Sin[(2 π/λ) x - (2 π f) t]
yl[λ_, f_, x_,t_] := Sin[(2 π/λ) x + (2 π f) t]

λ = 10;
f = 4;
T = 1/f;
L = 6 * (λ/2);

Animate[Plot[yr[λ, f, x, t], {x, 0, L}, PlotStyle->Red], {t, 0, 5 * T}, AnimationRunning->False, DefaultDuration->5, ControlPlacement -> Top]

Animate[Plot[yl[λ, f, x, t], {x, 0, L}, PlotStyle->Blue], {t, 0, 5 * T}, AnimationRunning->False, DefaultDuration->5, ControlPlacement -> Top]

Animate[Plot[{yl[λ, f, x, t],yr[λ, f, x, t],yr[λ, f, x, t] + yl[λ, f, x, t]}, {x, 0, L}, PlotStyle->{Red, Blue, Black}, PlotRange->{-2,2}, ImageSize->Scaled[0.8],PlotLabel->"Superposition leading to Standing Wave"],{t, 0, 5 * T}, AnimationRunning->False, DefaultDuration->15, ControlPlacement -> Top]

Animate[
Plot[yr[λ, f, x, t] + yl[λ, f, x, t], {x, 0, L}, PlotStyle->Black, PlotRange->{-2,2}, ImageSize->Scaled[0.8], PlotLabel->"Standing Wave"],{t, 0, 5 * T}, AnimationRunning->False, DefaultDuration-> 10, ControlPlacement -> Top]