nthoct: n-th Octave Frequencies and Wavelengths (IEC 61260)

Complies with IEC 61260-2014, ISO 3, ISO 266.
130 Downloads
Updated 8 Jan 2025

View License

nthoct complies with IEC 61260-2014.
Returns the exact and nominal values of the center frequencies, and the lower and upper band-egdes of the [n] times subdivided octaves between [lo] and [hi].
Note: In the context of this function, "frequency" is interchangable with "wavelength" or any logarithmic series of values.
Arguments:
n - (optional) octave subdivisions
lo - (optional) lowest center frequency
hi - (optional) highest center frequency
Return:
cx - exact center frequencies
cn - nominal center frequencies
bx - exact band-edges
bn - nominal band-edges
t - a table compiling centers and band-edges
Options:
ReferenceFrequency - reference frequency
Base - 2: perfect octaves, 10: perfect decades
IgnoreEvenDenominator - ignore IEC 61260-2014, 5.4.2 f (3)
IgnoreUniqueness - ignore IEC 61260-2014, E.3.2, E.3.3 & E.3.5
to make both cn AND bn unique
Reference Frequency:
Typically and with only few exceptions,
ReferenceFrequency = 1 kHz for technical applications,
ReferenceFrequency = 440 Hz for musical applications.
Base:
Base determines the usage of base 2 or 10.
Typically and with only few exceptions,
Base = 10 for technical application
Base = 2 for musical application (or when perfect octaves are required)
Typical n | Tech | Music (Base = 2)
----------+----------------+-------------------------
1 | (full) octave | octave
2 | half | tritone
3 | 3rd | major third
6 | 6th | whole step, major second
12 | 12th | half step, minor second
24 | ... | quarter step, 50 cents
Even denominators:
According to IEC 61260-2014 Section 5.4.2 formula (3),
G^((2x+1)/(2b)) is used, if n has an even denominator.
Consequently, the reference frequency IS NOT a center frequency but a band-edge.
With IgnoreEvenDenominator set true, this rule is ignored and, in turn,
the reference frequency becomes a center frequency.
Uniqueness of nominal values:
IEC 61260-2014, E.1 states that the nominal values shall be taken from the Renard numbers,
if n = 1 or 3.
IEC 61260-2014, E.2 states that the nominal values shall be the exact values
rounded to 3 significant digits, if n = 2.
IEC 61260-2014, E.3.2 and E.3.3 state that the nominal values shall be the exact values,
rounded to 3 significant digits, if the most significant one is 1 - 4
2 significant digits, if the most significant one is 5 - 9,
if 4 <= n <= 24
IEC 61260-2014, E.5 states that the nominal values shall be the exact values,
rounded to as many significant digits as needed to provide
unique mid-band values within a decade,
if n > 24
Examples: Electro-acoustic equipment often utilizes n-th octave bands,
but displays standardized nominal values with a
reference frequency of 1 kHz for user-friendlines.
(1) To obtain the audible frequencies in 3rd octaves, use
>> nthoct(3, 10, 20000, ...
>> ReferenceFrequency = 1000, Base = 10, ...
>> IgnoreEvenDenominator = false, IgnoreUniqueness = false)
Note: All arguments of nthoct are optional and these are the defaults.
To get the exact same returned values, use
>> nthoct()
(2) To obtain the frequencies of 6th octaves, use
>> nthoct(6)
Note: 6 is even. Therefore 1 kHz is not a center frequency, but a band-edge.
(3) To tune instruments to A = 440 Hz in equal 12-tone temperament, use
>> nthoct(12, 27.5, 4200, ReferenceFrequency = 440, Base = 2, IgnoreEvenDenominator = true)
Author: Axel Heusser

Cite As

Axel Heußer (2025). nthoct: n-th Octave Frequencies and Wavelengths (IEC 61260) (https://www.mathworks.com/matlabcentral/fileexchange/77055-nthoct-n-th-octave-frequencies-and-wavelengths-iec-61260), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with R2020b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
25.01.08

Due to a rounding mistake, the lower and upper range limits could be off by one.

23.05.17

Shortened function name: nthoct.
Minor updates to improve readability.

22.03.21

to avoid NaNs in the output table, it was re-arranged to lower band-edge | center freq | upper band-edge

22.02.23

fixed error when flipping the results' direction: flip -> flipud

22.02.17

Bug Fix: b was divided by the gcd of a and b, but a was already overwritten.
Added: short in/output descriptions.
Changed: output order.

22.02.16

Major Update: Now fully compliant with the latest IEC 61260.

21.04.12

added missing quotation mark, simplified table print command (if <print_table> contains 'print', the output table is printed to the console)

20.10.20

Bug fix for base 10 calculation! Previous version only calculated base 2, although base 10 was selected.

20.08.19

major update: no more estimating, everything is calculated mathematically exact -> avoids loops, slightly faster execution time

20.08.14.1

corrected Description

20.08.14

Printing the output table is now flagged with argin 'PrintTable'.

20.06.18

You can also pass n as in char type as a fraction 'a/b'. Passing n is equal to passing '1/n' as the first argument.
To print an overview of the results just un-comment the code below % print output in the %% output section.

20.06.17