Contents

OCTDEMO

VibraTools demonstration of third octave band spectrum analysis and some acoustics functionality in VibraTools (A-weighting time data).

Data is interactively loaded by the user selecting a suitable file, then a third octave spectrum is computed and plotted using the commands FANTERS and PLOTOCT. A digital filter for A-weighting of the time signal is then applied, and the third octave spectrum in dB(A) computed and plotted.

% Copyright (c) 2003-2006, Axiom EduTech AB, Ljusterö, Sweden. All rights reserved.
% URL: http://www.vibratools.com Email: info@vibratools.com

Load Data

FileName=uigetfile('*.mat','Select data file acoustic.mat');
load(FileName)
fs=1e5;

Compute and Plot Third-Octave Spectrum

Next, select frequencies for octave bands

[Lp,f] = fanters(Data,fs,20,20e3);
% Plot results assuming that the signal is sound pressure and plot in dB SPL
% including the total level computed in time domain (for full frequency range)
figure(1)
plotoct(f,Lp,std(Data),'T')
set(gca,'FontSize',5)               % Done for this web demo only! The font
%                                     sizes used by plotoct are optimized for full
%                                     screen plots, not suitable for this demo format.
Lowest band is   0.0002 of fs - resampling to  5000.00 Hz for bands up to  800.0 Hz center freq...

A-weight Data in Time Domain and Repeat 1/3-octave Analysis

Next, filter the time data with an A-weighting filter, compute third octave spectrum, and then plot like before but with A weighted and Linear Total level

[b,a]=afilter(fs);
ya=filter(b,a,Data);
[LpA,f]=fanters(ya,fs,20,20e3);
figure(2); set(gca,'FontSize',10)
plotoct(f,LpA,[std(Data) std(ya)],{'L','A'},'Sound Pressure, dB(A) SPL')
set(gca,'FontSize',5)
Lowest band is   0.0002 of fs - resampling to  5000.00 Hz for bands up to  800.0 Hz center freq...