       Simple Doppler effect

• To: mathgroup at smc.vnet.net
• Subject: [mg120662] Simple Doppler effect
• From: David Harrison <david.harrison at utoronto.ca>
• Date: Wed, 3 Aug 2011 07:05:00 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```I am trying to generate a Doppler effect for a sound wave. The source is moving by the observer.  The observer is stationary relative to the air.  The results I'm getting are bizarre, and 2 physicist colleagues are as stumped as I about what simple stupid mistake I'm making.  Here is the code that initialises the variables:

---
vSound = 343; (* speed of sound *)
vSource = 50; (* speed of source *)
xObserver = 300; (* x coord of observer *)
yObserver = 50;  (* y coord of observer *)
fSource = 440; (* frequency of source *)
(*
The source is initially at x = 0.
The source is a y = 0 always.
*)
---

Then I define a function of the position of the source as a function of time:

---
x[t_] := vSource * t
---

Now define the Doppler frequency.  It depends on the cosine of the angle between the source and the observer. I'm careful to use the cosine in a way to avoid possible singularities.

---
fDoppler[t_] := Module[
{xPosn, r },
xPosn = x[t];
r = Sqrt[ (xObserver - xPosn)^2 + yObserver^2];
fSource * vSound / ( vSound - vSource * (xObserver - xPosn) / r)
]
---

Finally, play what the observer hears, ignoring the fact that the intensity of the wave increases as the source is approaching and decreases as it is receding.

---
Play[ Sin[2 Pi fDoppler[t] t], {t, 0, 12}]
---

The sound starts at the higher Doppler frequency, then dips to a very low frequency as the source is at closest approach to the observer at 6 s, then rises to the lower Doppler frequency!  Weird.  I expect that the frequency around t = 6 s to smoothly decrease from the higher Doppler shifted frequency to the lower Doppler shifted one.

In order to "see" what is going on, make a plot for the frequency of the source = 1.

---
fSource = 1;
Plot[ Sin[2 Pi fDoppler[t] t], {t, 0, 12}, PlotPoints -> 100000]
---

At t = 6 you can see the same bizarre behaviour.

If you can point out what is going on here, you can show how stupid I (and two colleagues) are.

-- David Harrison

```

• Prev by Date: Re: LabelPlot: Changing size of CurveLabel
• Next by Date: Re: LabelPlot: Changing size of CurveLabel
• Previous by thread: Re: Using colored text in PlotLabel
• Next by thread: Re: Simple Doppler effect