I am comparing the spectral contents of some sound signals with MATLAB. I have quite a few measures but wanted one that represents the centre of gravity of the spectrum.
I used SpecCentroid()
found in File Exchange to calculate the linear mean spectrum centroid. Then I also used the function meanfreq()
and medianfreq()
from MATLAB.
I am struggling to understand (mathematically and perceptually) the differences of these measures and so I am not too sure which one to choose to best compare signals between each other.
Thanks a lot.
EDIT:
I have 2 types of sounds from different sources and try to compare their spectral 'signatures' to predict if they both would be relevant to some animal species. At this point, I am only interested in the frequency domain (although ultimately the time domain will be as equally important). I have so far compared the peak frequencies. However, as the signals are quite noisy, I was wondering if other measures could be more appropriate. That is why I was exploring the centroid, mean, median options.
Here is the same plot as before in the linear scale:
EDIT 2:
After Laurent Duval's answer and suggestions, I tested the estimated peak location, with different weights. For the signal example given above, I got:
\begin{array}{|c|c|c|} \hline\text{$p$} & \text{$f$} & \text{dispersion $d$} \\ \hline 1 & 979.6 & 979 \\ 2 & 493.12 & 627\\ 3 & 327 & 295\\ 4 & 296 & 135\\ 5 & 291.14 & 65\\ 6 & 285 & 35\\\hline \end{array}
The peak frequency as found with findpeaks()
was $285$.
Let's take one of my more noisy signals:
\begin{array}{|c|c|c|} \hline\text{$p$} & \text{$f$} & \text{dispersion $d$} \\ \hline 1 & 1460 & 826\\ 2 & 1295 & 768\\ 3 & 1122 & 719\\ 4 & 955 & 648\\ 5 & 811 & 562\\ 6 & 698 & 470\\\hline \end{array}
The peak frequency as found with findpeaks()
was $427$.
Example at $p=4$:
It is quite clear that the dispersion is much higher than for the last (less noisy) signal.