Re: How to simulate the Doppler Effect ?
- To: mathgroup at smc.vnet.net
- Subject: [mg36203] Re: How to simulate the Doppler Effect ?
- From: spammahamma at yahoo.com (No spammage)
- Date: Mon, 26 Aug 2002 04:16:35 -0400 (EDT)
- References: <aifl0t$pua$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
(bryan) wrote: > Dear All: > I want to make an animation that simulate the Doppler Effect, just 2D > circles travel out one by one, and at the same time,the origin of the > wave also moves toward one direction. I have no idea to make the speed > of the wave origin and the speed of traveling wave independent.Is > anyone has any idea to create the animation ?? Thanks in advance. > sincerely bryan I wrote this some time ago - the first function (dopp) draws just the circles, but the second one includes two lines which approximate the shock waves, I believe. The arguments of the functions are vx & vy (velocities in x & y directions) and tstart, tend, tstep which determine how many circles to draw and the spacing of the circles. I just used the Do loop to make the pictures, & then you can select the cells & pick "Animate". dopp[vx_,vy_,tstart_,tend_,tstep_]:=Show[Graphics[Table[{Hue[t/tend],Circle[{vx*t,vy*t},tend-t]},{t,tstart,tend,tstep}]],AspectRatio->Automatic,Axes->True,PlotLabel->"Mach " Sqrt(vx^2+vy^2)]; doppcone[vx_,vy_,tend_,tstep_]:=Show[Graphics[Table[{Hue[t/tend],Circle [{vx*t,vy*t},tend-t]},{t,0,tend,tstep}]],Graphics[Line[{{-tend*Sin[If[vx==0,0,ArcTan[vy/vx]]],tend*Cos[If[vx==0,0,ArcTan[vy/vx]]]},{Sign[vx]*Cos[If[vx==0,0,ArcTan[vy/vx]]]*(tend-tstep)*sqrt[vx^2+vy^2] - tstep*Sin[If[vx==0,0,ArcTan[vy/vx]]],Sin[If[vx==0,0,ArcTan[vy/vx]]]*Sign[vx]*(tend-tstep)*sqrt[vx^2+vy^2]+tstep*Cos[If[vx==0,0,ArcTan[vy/vx]]]}}]],Graphics[Line[{{tend*Sin[If[vx==0,0,ArcTan[vy/vx]]],-tend*Cos[If[vx==0,0,ArcTan[vy/vx]]]},{Sign[vx]*Cos[If[vx==0,0,ArcTan[vy/vx]]]*(tend-tstep)*sqrt[vx^2+vy^2]+tstep*Sin[If[vx==0,0,ArcTan[vy/vx]]],Sign[vx]*Sin[If[vx==0,0,ArcTan[vy/vx]]]*(tend-tstep)*s rt[vx^2+vy^2]-tstep*Cos[If[vx==0,0,ArcTan[vy/vx]]]}}]],AspectRatio->Automatic,Axes->True]; Do[dopp[i,0,0,10,1],{i,0,1.4,0.2}]; Hope I did that without typos - I can't see how to post the notebook without all the ugly \'s showing up. Email me if you want a copy.