Re: How to simulate the Doppler Effect ?
- To: mathgroup at smc.vnet.net
- Subject: [mg36294] Re: How to simulate the Doppler Effect ?
- From: "ng" <georgakopoulos at mindspring.com>
- Date: Fri, 30 Aug 2002 01:19:20 -0400 (EDT)
- References: <aifl0t$pua$1@smc.vnet.net> <akcqbj$571$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Neat!
The animation was jagged, though, so I fixed the text position and the image
size; it won't work for large vertical velocities:
margin=.8;
dopp[vx_,vy_,tend_,tstep_]:=Show[Graphics[
{Table[{Hue[t/tend],Circle[{vx*t,vy*t},tend-t]},
{t,0,tend,tstep}],
Text["Mach "<>ToString@Sqrt[vx^2+vy^2]
,{0,.5+tend},{-1,0}]
}],AspectRatio->Automatic,Axes->True,
PlotRange-> {{-tend-margin,margin+Max[tend,(vx tend)+.5]},
{-tend-margin,2margin+Max[tend,(vy tend)]}},
Ticks->{{-10,-5,0,5,10},Automatic},
ImageSize->{10 2 margin+10 (tend+Max[tend,(vx tend)+.5]),
10 3 margin+10(tend +Max[tend,(vy tend)])}];
Do[dopp[i,0,10,1],{i,0,1.4,0.2}];
By the way to avoid the slashes, CopyAs/TextOnly.
"No spammage" <spammahamma at yahoo.com> wrote in message
news:akcqbj$571$1 at smc.vnet.net...
> (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->Tr
ue,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]]]}}]],Graph
ics[Line[{{tend*Sin[If[vx==0,0,ArcTan[vy/vx]]],-tend*Cos[If[vx==0,0,ArcTan[v
y/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->Automati
c,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.
>