Learn R Programming

seewave (version 2.1.6)

wasp: WAve length and SPeed of sound

Description

This function returns the wavelength and the speed of sound of a given frequency in air, fresh-water or sea-water.

Usage

wasp(f, t = 20, c = NULL, s = NULL, d = NULL, medium = "air")

Arguments

f

frequency (Hz).

t

temperature (degree Celsius).

c

celerity (m/s) if a wavelength is to be found at a particular speed of sound.

s

salinity (parts per thousand) when medium is "sea".

d

depth (m) when medium is "sea".

medium

medium for sound propagation, either "air", "fresh" for fresh, or pure, water, "sea" for sea water.

Value

A list of two values is returned:

l

wavelength in meters

c

speed of sound in meters/second.

Details

Speed of sound in air is computed according to: $$c = 331.4 + 0.6\times{t}$$

Speed of sound in fresh-water is computed according to Marczak equation:

$$c = 1.402385.10^{3} + 5.038813\times{t} - 5.799136.10^{-2}\times{t^{2}}$$ $$+ 3.287156.10^{-4}\times{t^{3}} - 1.398845.10^{-6}\times{t^{4}}$$ $$+ 2.787860.10^{-9}\times{t^{5}}$$

with t = temperature in degrees Celsius; range of validity: 0-95 degrees Celcius at atmospheric pressure.

Speed of sound in sea-water is computed according to Mackenzie equation: $$c = 1448.96 + 4.591\times{t}- 5.304.10^{-2}\times{t^{2}}$$ $$+ 2.374.10^{-4}\times{t^{3}} + 1.34\times{(s-35)} + 1.63.10^{-2}\times{d}$$ $$+ 1.675.10^{-7}\times{d^{2}} - 1.025.10^{-2}\times{t}\times{(s-35)}$$ $$- 7.139.10^{-13}\times{t}\times{d^3}$$

with t = temperature in degrees Celsius; s = salinity in parts per thousand; d = depth in meters; range of validity: temperature 2 to 30 degrees Celcius, salinity 25 to 40 parts per thousand, depth 0 to 8000 m.

Wavelength is obtained following: $$\lambda = \frac{c}{f}$$ with c = speed of sound in meters/second; f = frequency in Hertz.

References

http://resource.npl.co.uk

Examples

Run this code
# NOT RUN {
# wavelength (m) of a 2000 Hz air-borne sound at 20 degrees Celsius
wasp(f=2000)$l
# [1] 0.1717

# sound speed in sea at 0 and -500 m
# for a respective temperature of 22 degrees Celcius and 11 degrees Celcius
wasp(f=1000,s=30,d=c(0,500),t=c(22,11),medium="sea")$c
# [1] 1521.246 1495.414

# wavelength (m) of a 1000 Hz sound in a medium unspecified where c = 1497 m/s
wasp(f=1000,c=1497)$l
# [1] 1.497

# variation of wavelength according to frequency and air temperature
op<-par(bg="lightgrey")
a<-seq(1000,20000,by=100) ; na<-length(a)
b<-seq(-20,40,by=10) ; nb<-length(b)
res<-matrix(numeric(na*nb),nrow=na)
for(i in 1:nb) res[,i]<-wasp(a,t=b[i])$l
matplot(x=a,y=res,type="l",lty=1,col= spectro.colors(nb),
  xlab="Frequency (Hz)",ylab="Wavelength (m)")
title("Wavelength of air-borne sound at different temperatures (deg. C)")
legend(x=15000,y=0.3,c("-20","-10","0","10","20","30","40"),
  lty=1,col= spectro.colors(nb),bg="grey")
par(op)
# }

Run the code above in your browser using DataLab