Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4141

Simple Doppler effect

From David Harrison <david.harrison@utoronto.ca>
Newsgroups comp.soft-sys.math.mathematica
Subject Simple Doppler effect
Date 2011-08-03 11:07 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j1ba5i$ajk$1@smc.vnet.net> (permalink)

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Simple Doppler effect David Harrison <david.harrison@utoronto.ca> - 2011-08-03 11:07 +0000
  Re: Simple Doppler effect "Kevin J. McCann" <Kevin.McCann@umbc.edu> - 2011-08-03 23:23 +0000
    Re: Simple Doppler effect Bert Aerts <bert.ram.aerts@gmail.com> - 2011-08-10 10:54 +0000

csiph-web