%% Convert Between Mel Scale and Hz
% 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

% Copyright 2018 The MathWorks, Inc.