rid.dt / 2 - t0);    <span class="comment">% [m]</span>

<span class="comment">% define absorption value and convert to correct units</span>
tgc_alpha_db_cm = medium.alpha_coeff * (tone_burst_freq * 1e-6)^medium.alpha_power;
tgc_alpha_np_m = tgc_alpha_db_cm / 8.686 * 100;

<span class="comment">% create time gain compensation function based on attenuation value and
% round trip distance</span>
tgc = exp(tgc_alpha_np_m * 2 * r);

<span class="comment">% apply the time gain compensation to each of the scan li