# How to calculate the mean/center frequency of the spectrum?

Assume that the Fourier Transform of $x(t)$ is $X(j\omega)$. And I want to calculate the $\bar{\omega}$ which is the center freqency in the spectrum ( the highest).

• And a classmate tells me this formula $$\bar{\omega} = \int \omega X(j\omega)\ d\omega$$ could be used to calculate the center frequency ? But it is the first moment, it seems that the result is mean frequency.
• Could anyone help me with this question?
• What is the mean and center frequency of the spectrum?

There is no solution in Alan's book.

EDIT:

Maybe I did not state the center frequency clearly. I want to find out the frequency where the amplitude spectrum is biggest.

Another situation: assume that the signal is discrete $x[n]$. So we could just compute a period $[-\pi, \pi]$. In this case, this formula could represent the center frequency?

• @LaurentDuval Yep, I want to find out the frequency which amplitude is the largest one in the spectrum for the single-mount signal. What do you mean by power tends to infinity? – stander Qiu Mar 29 '17 at 13:08
• @LaurentDuval Yep, I have tried the code. Now I want to do the calculation. So I want reference for the formula. You could reply to me if you have time. – stander Qiu Mar 29 '17 at 13:52

[EDIT] If just want to compute the location of the maximum amplitude, you just have to compute the maximum. You can work in a more generic context, however. As you remarked, the notion of center frequency is not evident. The notion of centroid could be more pertinent.

I assume that your signal is real (since you are talking about a maximum, not well defined in the complex domain). Since its amplitude spectrum is symmetric about $0$, this possible center of mass is useless, since it is the same for all real signals (the zero-frequency). More likely, one is looking at a more useful quantity, based on a one-sided spectrum:

$$\overline{\omega}_W = \int_{\mathbb{R}^+} \omega W(X(\omega))d\omega$$

where $W(X(\omega))$ is a weighting function that (may) depend on the spectrum $X$. The "mean" $\overline{\omega}_W$ will depend on the choice of $W$. A code was given in the answer to Finding the right measure to compare sound signals in the frequency domain.

You can base it on an absolute value, or something else (positive). But it is important to have a normalized weight: it should, somehow, sum to one, like for a traditional center of mass. The reason is scaling homogeneity. The mean should not change if you multiply every $X(w)$ by the same quantity.

For orthogonal transforms, based on the energy conservation:

$$\int [x(t)|^2dt = \int [X(\omega)|^2d\omega$$

it is very common to use a mean/center definition based on an energetic weight, ie a square of the absolute spectrum. So every often, the mean frequency is defined as:

$$\overline{\omega}_2 = \frac{\int_{\mathbb{R}^+} \omega|X(\omega)|^2d\omega}{\int_{\mathbb{R}^+}|X(\omega)|^2d\omega}\,.$$

This choice is very sensitive when dealing with time/frequency location uncertainty related to the Weyl-Pauli-Heisenberg inequalities.

But you can use other $L_p$ norms, with:

$$\overline{\omega}_p = \frac{\int_{\mathbb{R}^+} \omega|X(\omega)|^pd\omega}{\int_{\mathbb{R}^+}|X(\omega)|^pd\omega}\,.$$

As $p\to\infty$, this estimator converges to the location of a maximum, as demonstrated in Metric Spaces: Why $L_\infty$ selects the maximum value.

When $p=1$, this is called the spectral centroid, or "brightness" (of sound), or simply "centre of gravity of amplitudes". It is described with other moments in Chapter 6.1 Spectral shape description. When $p=2$, this is sometimes called the power spectral centroid.

I have not found yet useful references for other powers (still searching).

• Yep. I just use MATLAB to test a signal. The result is the last formular you give. Thank you! – stander Qiu Mar 26 '17 at 13:53
• But why is $\bar{w}_1$ not true? Why amplitude does not make sense? – stander Qiu Mar 26 '17 at 13:54
• Hello! I still have a question. Could you discuss with me in the chat?chat.stackexchange.com/rooms/56145/the-mean-frequency Thanks!:) – stander Qiu Mar 28 '17 at 1:13

Center frequency makes sense when there is some sort of bandwidth $B$ for the signal $x(t)$. When the bandwidth is defined, the center frequency is also automatically obtained since, the bandwidth is defined with respect to that.

The defined metric in the question does not seem to be useful. I would say (excluding some normalization factor) something like $$\bar{\omega} = \int \omega \lvert X(\omega)\rvert\ d\omega$$ makes more sense since it can be interpreted as the expected (mean) angular frequency present in the signal $x(t)$, or the average frequency at which the signal's energy is concentrated.

This can be identical to the central frequency $f_m$ of a signal of bandwidth $B$ whose spectrum is nonzero between $f_l=f_m-B/2$ and $f_h=f_m+B/2$. However, it is not the case most often. Indeed, this holds only if the signal's spectrum is symmetric with respect to $f_m$. In the general case, the two are different.

• I am very sorry for not stating the problem clearly. I have edited the question. – stander Qiu Mar 26 '17 at 11:41
• And you use $|X(w)|$ instead of $X(w)$. Could you tell me why? – stander Qiu Mar 26 '17 at 11:45
• @standerQiu $X(w)$ is complex. Without absolute value (ie. with weighting alone etc) it would be wrong since the result of integral would be complex. " I want to find out the frequency where the amplitude spectrum is biggest" but ultimately you accepted the same answer! (i.e. the center of energy) – msm Mar 26 '17 at 20:32