Logarithmic Scales in Acoustic Spectra
By José Luis Gómez-Muñoz
http://homepage.cem.itesm.mx/jose.luis.gomez/
Sawtooth wave
These are three periods of an approximation to a sawtooth wave:
PlotSin2 Pi 523 t 1
3
1
5
1
2
Sin2 Pi 1569 t Sin2 Pi 2615 t Sin2 Pi 1046 t 1
4
1
6
Sin2 Pi 2092 t Sin2 Pi 3138 t, t, 0, 3 523
1.5
1.0
0.5
0.001
0.002
0.003
0.004
0.005
0.5
1.0
1.5
We can listen to the wave if we replace the command Plot with the command Play and the interval
{t,0,3/523} (three period) with the interval {t,0,2} (two seconds), as shown below (if you are reading this
document in Mathematica or the CDFPlayer, press the button
PlaySin2 Pi 523 t 1
3
1
5
1
2
Sin2 Pi 1569 t Sin2 Pi 2615 t in the result of the calculation below):
Sin2 Pi 1046 t 1
4
1
6
Sin2 Pi 2092 t Sin2 Pi 3138 t, t, 0, 2
2
logarithmicscales.cdf
We can visualize the amplitude-spectrum of this wave with the command ListPlot. Remember that
every point is made of the frequency and the corresponding amplitude, therefore the expression
1
3
1
3
Sin2 Pi 1569 t becomes the point 1569, , and so on, as shown below:
ListPlot
523, 1, 1046,
1
, 1569,
1
, 2092,
1
, 2615,
1
2
3
4
5
Filling Axis, FillingStyle Thick,
AxesOrigin 0, 0, Frame True, PlotRange All,
PlotLabel "Amplitude spectrum"
, 3138,
1
6
,
Amplitude spectrum
1.0
0.8
0.6
0.4
0.2
0.0
0
500
1000
1500
2000
2500
3000
We can also visualize the power-spectrum of this wave with the command ListPlot. Notice that the
1 2
2
1 2
3
important difference with the previous plot is that the amplitudes are squared: 12 , , , ...
logarithmicscales.cdf
3
ListPlot
523, 12 , 1046,
2092,
1
2
1
2
2
, 1569,
1
, 2615,
2
1
2
3
,
1
, 3138,
2
,
4
5
6
Filling Axis, FillingStyle Red, PlotStyle Red,
AxesOrigin 0, 0, Frame True, PlotRange All,
PlotLabel "Power spectrum"
Power spectrum
1.0
0.8
0.6
0.4
0.2
0.0
0
500
1000
1500
2000
2500
3000
Notice that the spectrum above shows very small values together with large ones. This usually happens
in Acoustics, and the details of the small amplitudes can be very important. Therefore we will change to
another kind of plot, where small values and large values can be seen at the same time. Replace
ListPlot with ListLogPlot, and replace AxesOrigin{0,0} with AxesOrigin{0.01,0.01}, and you
obtain the following logarithmic plot for the same spectrum:
ListLogPlot
523, 12 , 1046,
2092,
1
2
1
2
, 1569,
1
2
1
3
, 3138,
2
,
1
2
,
4
5
6
Filling Axis, FillingStyle Red, PlotStyle Red,
AxesOrigin 0.01, 0.01, Frame True, PlotRange All,
PlotLabel "Power spectrum"
, 2615,
2
4
logarithmicscales.cdf
Power spectrum
1
0.50
0.10
0.05
0
500
1000
1500
2000
2500
3000
Here we have the two graphs, they are for the same waveform, they are actually the same spectrum,
see the power values and the decibel values:
Using a logarithmic scale is similar
to the effect of this mirror, so that
the small peaks are enlarged and can
be compared with the large peaks in
the spectrum
Furthermore, we can also have a logarithmic scale in the horizontal axis. In order to obtain that graph,
replace the command ListLogPlot with the command ListLogLogPlot and set AxesOrigin
{450,0.01}:
logarithmicscales.cdf
5
ListLogLogPlot
523, 12 , 1046,
2092,
1
2
1
2
, 2615,
2
, 1569,
1
2
1
3
, 3138,
2
,
1
2
,
4
5
6
Filling Axis, FillingStyle Red, PlotStyle Red,
AxesOrigin 450, 0.01, Frame True, PlotRange All,
PlotLabel "Power spectrum"
Power spectrum
1
0.50
0.10
0.05
1500
2500
Here we have the two graphs, they are for the same waveform, they are actually the same spectrum,
check the coordinates of each point in both of them, also see the decibel and octave scales:
Interactive Demonstration of Logarithmic Scales
Please enable dynamic content in Mathematica or the CDFPlayer in order to be able to interact with
6
logarithmicscales.cdf
Please enable dynamic content in Mathematica or the CDFPlayer in order to be able to interact with
the following demonstration:
plot type
ListPlot
ListLogPlot
waveform
sawtooth
square
spectrum
amplitude
power
ListLogLinearPlot
wave 1
wave 2
ListLogLogPlot
wave 3
show hertz
show magnitude
show octaves
show decibels
show waveform
show function
play sound
The Periodogram command
Mathematicas command Periodogram can be used to obtian the power spectrum, with a logarithmic
vertical axis (decibels) and a linear horizontal axis (Hertz)
logarithmicscales.cdf
PeriodogramPlaySin2 Pi 523 t 1
3
1
Sin2 Pi 1569 t 1
4
1
1
2
7
Sin2 Pi 1046 t Sin2 Pi 2092 t Sin2 Pi 2615 t Sin2 Pi 3138 t, t, 0, 2,
5
6
PlotRange 15, 33,
PlotStyle Red
30
25
20
1000
2000
3000
4000
Compare the previous graph, with the command Periodogram, and the graph below, with the comand
ListLogPlot:
ListLogPlot
523, 12 , 1046,
2092,
1
2
1
2
, 1569,
1
2
1
3
, 3138,
2
,
1
2
,
4
5
6
Filling Axis, FillingStyle Red, PlotStyle Red,
AxesOrigin 0.01, 0.01, Frame True, PlotRange All,
PlotLabel "Power spectrum"
, 2615,
2
8
logarithmicscales.cdf
Power spectrum
1
0.50
0.10
0.05
0
500
1000
1500
2000
2500
3000
Exercises
Exercise 1
Graph this amplitude spectrum with logarithmic scales:
Exercise 2
Graph this amplitude spectrum with logarithmic scales:
logarithmicscales.cdf
Author: José Luis Gómez-Muñoz http://homepage.cem.itesm.mx/jose.luis.gomez/
DateString, $Version
Wed 14 Jan 2015 10:43:58, 10.0 for Microsoft Windows 64bit June 29, 2014
9
© Copyright 2026 Paperzz