SPL_dB = spl(p_Pa,ref)
Calculate sound pressure level (in dB) of given pressure signal 'p_Pa'. Input variable 'ref' can be any userdefined reference pressure or simply 'air' or 'water' to use standard values for air and water.
Pressure signal input p_Pa must be in units of pascals if 'air' or 'water' are used to define the reference pressure. Otherwise any pressure signal units are acceptable, given they match the units of the reference pressure.
Pressure signal vector should be long enough to capture nature of the signal. In other words, a single pressure value is not sufficient for rootmeansquare calculation. Note that this does account for frequency content. Aweighted decibels (dBA) are frequencydependent. This function does not compute dBA.
Example using Matlab's builtin train whistle sound:
load train % (let's assume y is has pascals as its units)
spl(y,'air')
ans =
84.6
The example above gives the same as the following:
load train % (let's assume y is has pascals as its units)
spl(y,20*10^6)
ans =
84.6
Note: Typically we only write decibels to integer values or one decimal place. Anything on the hundredthofadecibel level is probably just noise and can be ignored.
