MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simple Doppler effect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120937] Re: Simple Doppler effect
  • From: Dana DeLouis <dana01 at me.com>
  • Date: Wed, 17 Aug 2011 05:54:03 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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

Hi.  I was wondering if you have a solution.  I=92m not an expert, but 
here is what I came up with so far.
I could not get your example to work, but I think I got other easier 
examples to work:

If one wanted to do the example found in Help on the function 'Play for 
a constant 440 Hz, it appears one does this:
This is what you want:

f = 440;

Hence:
z = Integrate[2*Pi*f, t]
880*Pi*t

Play[Sin[z], {t, 0, 10}]

This seems to match the example.

A Sound that drops linearly from 400 to 0 appears to be this:

f = 400 - 40*t;
z = Integrate[2*Pi*f, t]
800*Pi*t - 40*Pi*t^2

Play[Sin[z], {t, 0, 10}]

I did a parabolic curve just for testing:

{{0, 0}, {6, 440}, {12, 0}};
f = Expand[InterpolatingPolynomial[%, t]]
(440*t)/3 - (110*t^2)/9

z = Integrate[2*Pi*f, t]
(440*Pi*t^2)/3 - (220*Pi*t^3)/27

Play[Sin[z], {t, 0, 12}]


For your example, I arrived at the same equation, just a  little 
differently:

dist = Assuming[t>0,Simplify[Norm[{300-50 t,50}]]]
50 Sqrt[1+(-6+t)^2]

v=343;
f[t_] = 440((v+0)/(v+D[dist,t]))

150920/(343+(50 (-6+t))/Sqrt[1+(-6+t)^2])

This appears to match your equation:

Table[f[t] == fDoppler[t], {t, 0, 12}] // Union

{True}

However, Integrating the above function returned a function with 
Imaginary parts, hence the Play function will not work.

z = Assuming[0 <= t <= 12, FullSimplify[Integrate[2*Pi*f[t], t]]]

This does not work like you mentioned.  It seems like there should be an 
easy solution.
Hopefully, someone can jump in here & help.  I'd be curious on the 
solution as well.

= = = = =
Dana DeLouis
$Version
8.0 for Mac OS X x86 (64-bit) (November 6, 2010)




On Aug 3, 7:07 am, David Harrison <david.harri... at utoronto.ca> wrote:
> 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: What "Sort" option of :Values does?
  • Next by Date: Parameter optimizatrion in modified diffusion equation
  • Previous by thread: Re: Simple Doppler effect
  • Next by thread: Re: Simple Doppler effect