This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

hz2mel

Convert from hertz to mel scale

Syntax

mel = hz2erb(hz)

Description

example

mel = hz2erb(hz) converts values in hertz to values on the mel frequency scale.

Examples

collapse all

Set two bounding frequencies in Hz and then convert them to the mel scale.

b = hz2mel([20,8000]);

Generate a row vector of 32 values uniformly spaced on the mel scale.

melVect = linspace(b(1),b(2),32);

Convert the row vector of values into equivalent frequencies in Hz.

hzVect = mel2hz(melVect);

Plot the two vectors for comparison. As mel values increase linearly, Hz values increase exponentially.

plot(melVect,hzVect,'o')
title('Mel vs Hz')
xlabel('Mel')
ylabel('Hz')
grid on

Input Arguments

collapse all

Input frequency in Hz, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: single | double

Output Arguments

collapse all

Output frequency on the mel scale, returned as a scalar, vector, matrix, or multidimensional array the same size as hz.

Data Types: single | double

Algorithms

The frequency conversion from Hz to the mel scale uses the following formula:

mel=2595log10(1+hz700)

References

[1] O'Shaghnessy, Douglas. Speech Communication: Human and Machine. Reading, MA: Addison-Wesley Publishing Company, 1987.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2019a