fdoppler {seewave} | R Documentation |
This function computes the altered frequency of a moving source due to the Doppler effect.
fdoppler(f, c = 340, vs, vo = 0, movs = "toward", movo = "toward")
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. |
movs |
movement direction of the source in relation with observer position,
either |
movo |
movement direction of the observer in relation with the source position,
either |
The altered frequency f' is computed according to:
f' = f*(c+/-vo/(c+/-vs))
with f = original frequency produced by the source (in Hz or kHz),
vs = speed of the source,
vo = speed of the observer.
The altered frequency is returned in a vector.
You can use wasp
to have exact values of c
.
See examples.
Jerome Sueur sueur@mnhn.fr
# 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)