v_soundspeed

PURPOSE ^

V_SOUNDSPEED gives the speed of sound, density of air and acoustic impedance as a function of temp & pressure [V,D,Z]=(T,P,M,G)

SYNOPSIS ^

function [v,d,z]=v_soundspeed(t,p,m,g)

DESCRIPTION ^

V_SOUNDSPEED gives the speed of sound, density of air and acoustic impedance as a function of temp & pressure [V,D,Z]=(T,P,M,G)

  Inputs:  T        air temperature in Celsius  [20 deg C]
           P        air pressure [1 atm]
           M        average molecular weight of air [0.0289644 kg/mol]
           G        adiabatic constant for air [1.4]

 Outputs:  V        is the speed of sound in m/s
           D        density of air in kg/m^3
           Z        characteristic impedance of air Pa.s/m

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [v,d,z]=v_soundspeed(t,p,m,g)
0002 %V_SOUNDSPEED gives the speed of sound, density of air and acoustic impedance as a function of temp & pressure [V,D,Z]=(T,P,M,G)
0003 %
0004 %  Inputs:  T        air temperature in Celsius  [20 deg C]
0005 %           P        air pressure [1 atm]
0006 %           M        average molecular weight of air [0.0289644 kg/mol]
0007 %           G        adiabatic constant for air [1.4]
0008 %
0009 % Outputs:  V        is the speed of sound in m/s
0010 %           D        density of air in kg/m^3
0011 %           Z        characteristic impedance of air Pa.s/m
0012 
0013 % Notes: (1) Sound pressure is often measured in dB (SPL) relative to 20uPa [20*log10(p/p0)]
0014 %            Sound pressure is inversely proportional to distance.
0015 %        (2) Sound intensity is often measured indB relative to pW/m^2,[10*log10(J*10^12)]
0016 %            Intensity is inversely proportional to distance squared.
0017 %        (3) Intensity * impedance = pressure^2, so with the default values, 1 pW/m^2 = sqrt(Z) = 20.33 uPa
0018 %            So: X dB (SPL) = X-93.98 dB (Pa) = X-0.14 dB (pW/m^2) =  X-120.14 dB (W/m^2)
0019 %            where 93.98=20*log10(50000), 0.14=10*log10(Z/400), 120.14=10*log10(1e12*z/400)
0020 %        (4) The default air pressure (which does not affect sound speed) in various units is:
0021 %            1 atm = 101325 Pa = 1.01325 bar = 1.0332 at = 760 torr = 14.696 psi
0022 
0023 %       Copyright (C) Mike Brookes 2006
0024 %      Version: $Id: v_soundspeed.m 10865 2018-09-21 17:22:45Z dmb $
0025 %
0026 %   VOICEBOX is a MATLAB toolbox for speech processing.
0027 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0028 %
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 %   This program is free software; you can redistribute it and/or modify
0031 %   it under the terms of the GNU General Public License as published by
0032 %   the Free Software Foundation; either version 2 of the License, or
0033 %   (at your option) any later version.
0034 %
0035 %   This program is distributed in the hope that it will be useful,
0036 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0037 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0038 %   GNU General Public License for more details.
0039 %
0040 %   You can obtain a copy of the GNU General Public License from
0041 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0042 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0044 
0045 if nargin<4
0046     g=1.4;
0047     if nargin<3
0048         m=0.0289644;      % gm/mol
0049         if nargin<2
0050             p=1;
0051             if nargin<1
0052                 t=20;
0053             end
0054         end
0055     end
0056 end
0057 p=p*101325; % convert pressure: atm to pascal
0058 k=t+273.15;  % absolute temperature
0059 r=8.3144;  % J/(mol K) universal gas constant
0060 d=p*m/(r*k);
0061 v=sqrt(g*r*k/m);
0062 z=v*d;

Generated by m2html © 2003