Matlab scripts for sound velocity

UNESCO ’95 sound speed equations

Fitting the velocity of sound (Vsnd) calculated from the UNESCO ’95 equation to the van ‘t Hoff equation format was a multi-step process. The following Matlab® code script files were used:

  1. Vsnd_tp.m – Fit sound speed calculated with UNESCO ’95 equation for T,P matrix at SP=35 to the van ‘t Hoff equation.
    • Vsnd_un95.m – Calculate Vsnd using the UNESCO ’95 equation at S,T,P. Called by #1 above.
    • setfont.m – Set font style and size for plots. Called by #1 above.
  2. Vsnd_tp_xplt.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (3rd order in T and 3rd order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  3. Vsnd_tp_xplt2.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (4th order in T and 2nd order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  4. Vsnd_tp_xplt3.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (4th order in T and 3rd order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  5. Vsnd_tp_xplt4.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (4th order in T and 4th order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  6. Vsnd_sc.m – Calculation of Vsnd salinity correction term, ΔV, with UNESCO ’95 equation for S,T matrix at P = 0 dbar.
  7. Vsnd_sc_xplt.m – Comparison check plots of Vsnd(S) calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation.
    • Figure 1: ln(Vsnd) vs 1000/T°K at P = 0 dbar.
    • Figure 2: Vsnd vs T°C at P = 0 dbar.
  8. Vsnd_stp_xplt.m – Comparison check plots of Vsnd(S,T,P) calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation.
    • Figure 1: Vsnd vs T°C at P = 0 bar.
    • Figure 2: Vsnd vs T°C at P = 200 bar.
    • Figure 3: Vsnd vs T°C at P = 400 bar.
    • Figure 4: Vsnd vs T°C at P = 600 bar.
    • Figure 5: Vsnd vs T°C at P = 800 bar.
    • Figure 6: Vsnd vs T°C at P = 1000 bar.
  9. Vsnd_x_sigfigs.m – Comparison of Vsnd(S,T,P) calculated by the van ‘t Hoff format equation using full precision coefficients (15 digits) vs reduced length coefficients in order to find minimum coefficient length needed in order to calculate Vsnd without any loss of accuracy.
    • Vsnd_flc1.m – van ‘t Hoff Vsnd function with full length coefficients.
    • Vsnd_stp1.m – van ‘t Hoff Vsnd function with reduced length coefficients.

Then we made a series of plots to demonstrate the closeness of fit and the minimal size of the offsets between Vsnd(UNESCO ’95) and Vsnd(van ‘t Hoff):

  1. xPlot_AR01S54.m – Sound speed comparison for WOCE Leg AR01 / station 54.
    • AR01_S54.mat – Hydrographic data for WOCE Leg AR01 / station 54.
    • setfont.m – Set font style and size for plots.
    • Vsnd_un95.m – Matlab function to calculate Vsnd using the UNESCO ’95 equation.
    • Vsnd_stp1.m – Matlab function to calculate Vsnd using the van ‘t Hoff format equation fit to the UNESCO ’95 data matrix.
  2. xPlot_P17NS10.m – Sound speed comparison for WOCE Leg P17N / station 10.
    • P17N_S10.mat – Hydrographic data for WOCE Leg P17N / station 10.
  3. yPlot_Contours.m – Draw 2-D contours showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation.
  4. zPlot_Offsets_fig1.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 33 to 37.
  5. zPlot_Offsets_fig2.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 15 to 40.

TEOS-10 sound speed equations

Fitting the velocity of sound (Vsnd) calculated from the Thermodynamic Equation of Seawater 2010 (TEOS-10) to the van ‘t Hoff equation format was also a multi-step process. Note: to use the following equations, the Matlab® Gibbs-SeaWater (GSW) Oceanographic Toolbox, which contains the TEOS-10 equations, must be installed on your computer and the toolbox folders must be in your Matlab® path. For more information about the GSW Oceanographic Toolbox please refer to: McDougall, T.J. and P.M. Barker (2011) Getting started with TEOS-10 and the Gibbs Seawater (GSW) Oceanographic Toolbox, 28pp., SCOR/IAPSO WG127, ISBN 978-0-646-55621-5.

  1. Vsnd_tp.m – Fit sound speed calculated with TEOS-10 equation for T,P matrix at SP=35 to the van ‘t Hoff equation.
    • setfont.m – Set font style and size for plots. Called by #1 above.
  2. Vsnd_sc.m – Calculation of Vsnd salinity correction term, ΔV, with TEOS-10 equation for S,T matrix at P = 0 dbar.
  3. Vsnd_x_sigfigs.m – Comparison of Vsnd(S,T,P) calculated by the van ‘t Hoff format equation using full precision coefficients (15 digits) vs reduced length coefficients in order to find minimum coefficient length needed in order to calculate Vsnd without any loss of accuracy.
    • Vsnd_flc2.m – van ‘t Hoff Vsnd function with full length coefficients.
    • Vsnd_stp2.m – van ‘t Hoff Vsnd function with reduced length coefficients.

Then we made a series of plots to demonstrate the closeness of fit and the minimal size of the offsets between Vsnd(TEOS-10) and Vsnd(van ‘t Hoff):

  1. xPlot_AR01S54_6a.m – Sound speed comparison for WOCE Leg AR01 / station 54.
    • AR01_S54.mat – Hydrographic data for WOCE Leg AR01 / station 54.
    • Vsnd_stp2.m – Matlab function to calculate Vsnd using the van ‘t Hoff format equation fit to the TEOS-10 data matrix.
  2. xPlot_P17NS10_6a.m – Sound speed comparison for WOCE Leg P17N / station 10.
    • P17N_S10.mat – Hydrographic data for WOCE Leg P17N / station 10.
    • Vsnd_stp2.m – Matlab function to calculate Vsnd using the van ‘t Hoff format equation fit to the TEOS-10 data matrix.
  3. yPlot_Contours_6a.m – Draw 2-D contours showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the TEOS-10 speed of sound equation.
  4. zPlot_Offsets_6a_fig1.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 33 to 37.
  5. zPlot_Offsets_6a_fig2.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 15 to 40.

Lastly we made a series of plots to demonstrate the closeness of fit between Vsnd calculated with the TEOS-10 computationally efficient equation (using 75 coefficients) and the TEOS-10 full equation (with 104 coefficients) as was used above:

  1. xPlot_AR01S54_6b.m – Sound speed comparison for WOCE Leg AR01 / station 54.
    • AR01_S54.mat – Hydrographic data for WOCE Leg AR01 / station 54.
  2. xPlot_P17NS10_6b.m – Sound speed comparison for WOCE Leg P17N / station 10.
    • P17N_S10.mat – Hydrographic data for WOCE Leg P17N / station 10.
  3. yPlot_Contours_6b.m – Draw 2-D contours showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the TEOS-10 speed of sound equation.
  4. zPlot_Offsets_6b_fig1.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 33 to 37.
  5. zPlot_Offsets_6b_fig2.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 15 to 40.

Products

Data repository
Data policy
What is happening in Monterey Bay today?
Central and Northern California Ocean Observing System
Chemical data
Ocean float data
Slough data
Mooring ISUS measurements
Southern Ocean Data
Mooring data
M1 Mooring Summary Data
M1 ADCP (CeNCOOS)
M1 Asimet
M1 Download Info
M1 EMeter
M1 Fluorometer (CeNCOOS)
Molecular and genomics data
ESP Web Portal
Seafloor mapping
Upper ocean data
Spatial Temporal Oceanographic Query System (STOQS) Data
Image gallery
Video library
Seminars
Previous seminars
David Packard Distinguished Lecturers
Research software
Video Annotation and Reference System
System Overview
Knowledgebase
Annotation Interface
Video Tape User Guide
Video File User Guide
Annotation Glossary
Query Interface
Basic User Guide
Advanced User Guide
Results
Query Glossary
FAQ
VARS Publications
Oceanographic Decision Support System
MB-System seafloor mapping software
How to Download and Install MB-System
MB-System Documentation
MB-System Announcements
MB-System Announcements (Archive)
MB-System FAQ
MB-System Discussion Lists
MB-System YouTube Tutorials
Matlab scripts: Linear regressions
Introduction to Model I and Model II linear regressions
A brief history of Model II regression analysis
Index of downloadable files
Summary of modifications
Regression rules of thumb
Results for Model I and Model II regressions
Graphs of the Model I and Model II regressions
Which regression: Model I or Model II?
Matlab scripts: Oceanographic calculations
Matlab scripts: Sound velocity
Visual Basic for Excel: Oceanographic calculations
Educational resources
MBARI Summer Internship Program
2017 Summer Interns Blog
Education and Research: Testing Hypotheses (EARTH)
EARTH workshops
2016—New Brunswick, NJ
2015—Newport, Oregon
2016 Satellite workshop—Pensacola, FL
2016 Satellite workshop—Beaufort, NC
EARTH resources
EARTH lesson plans
Lesson plans—published
Lesson plans—development
Lesson drafts—2015
Lesson drafts—2016 Pensacola
Adopt-A-Float Program
Center for Microbial Oceanography: Research and Education (C-MORE) Science Kits
Publications
Sample archive