fdoppler {seewave}R Documentation

Doppler effect

Description

This function computes the altered frequency of a moving source due to the Doppler effect.

Usage

fdoppler(f, c = 340, vs, vo = 0, movs = "toward", movo = "toward")

Arguments

f

original frequency produced by the source (in Hz or kHz)

c

speed of sound in meters/second.

vs

speed of the source in meters/second.

vo

speed of the observer in meters/second. The observer is static by default i.e. vo = 0

movs

movement direction of the source in relation with observer position, either "toward" (by default) or "away".

movo

movement direction of the observer in relation with the source position, either "toward" (by default, but be aware that the observer is static by default) or "away".

Details

The altered frequency f' is computed according to:

f{'} = f\times{\frac{c \pm v_{o}}{c \pm v_{s}}}

with f = original frequency produced by the source (in Hz or kHz),
vs = speed of the source,
vo = speed of the observer.

Value

The altered frequency is returned in a vector.

Note

You can use wasp to have exact values of c. See examples.

Author(s)

Jerome Sueur sueur@mnhn.fr

See Also

wasp

Examples

# a 400 Hz source moving toward or away from the observer at 85 m/s
fdoppler(f=400,vs=85)
# [1] 533.3333
fdoppler(f=400,vs=85,movs="away")
# [1] 320
# use wasp() if you wish to have exact sound speed at a specific temperature
fdoppler(f=wasp(f=400,t=25)$c, vs=85)
# [1] 461.8667
# Doppler effect at different source speeds
f<-seq(1,10,by=1); lf<-length(f)
v<-seq(10,300,by=20); lv<-length(v)
res<-matrix(numeric(lf*lv),ncol=lv)
for(i in 1:lv) res[,i]<-fdoppler(f=f,vs=v[i])
op<-par(bg="lightgrey")
matplot(x=f,y=res,type="l",lty=1,las=1,col= spectro.colors(lv),
xlab="Source frequency (kHz)", ylab="Altered frequency (kHz)")
legend("topleft",legend=paste(as.character(v),"m/s"),
lty=1,col= spectro.colors(lv))
title(main="Doppler effect at different source speeds")
par(op)

[Package seewave version 2.2.3 Index]