## Calculate the harmonic mean sound speed through a profile

version 1.1.0.0 (2.95 KB) by
Given a vertical sound speed profile, calculate the harmonic mean speed of sound to some depth.

Updated 03 Jun 2020

In ocean acoustics one often wants to calculate the distance a sound pulse will travel in a given amount of time. When the pulse is sent directly down, we can neglect the effect of refraction of the sound pulse and need only consider the mean sound speed. Dividing the mean sound speed by the travel time gives the distance the pulse traveled. [This is the calculation that must be performed when operating a single-beam echo-sounder directed vertically down into the water column. The two-way travel time must be divided by two first.]

Suppose one is given a sound speed profile (sound speeds [ssp] and the associated depths [z] at which they were measured.). Most will realize that one cannot simply average the sound speeds to obtain the proper mean sound speed for this calculation. However many will incorrectly assume that a depth-weighted mean sound will produce the correct answer.
Unfortunately it does not.

One must instead divide the total depth by the sum of the time it takes
to the sound to pass through each layer of constant sound speed. This is
called the 'harmonic mean'. Given a sound speed profile and a depth to which to consider, sndsped_mean.m performs this calculation.

### Cite As

Val Schmidt (2021). Calculate the harmonic mean sound speed through a profile (https://www.mathworks.com/matlabcentral/fileexchange/36358-calculate-the-harmonic-mean-sound-speed-through-a-profile), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2010a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux