Library / Signal processing and digital filters / DSP-19
Signal processing and digital filters
Power-weighted spectral centroid
Mean frequency of a spectrum weighted by power, from up to five bin frequencies and their non-negative powers (set unused powers to zero).
- Ref
- DSP-19
- Rev
- v1
- Field
- Signal processing and digital filters
- Result
- fc [Hz]
The spectral centroid is the power-weighted mean frequency, fc = Σ fk Pk / Σ Pk, the centre of gravity of the spectrum. Use non-negative bin powers; for a PSD with unequal bin widths, multiply by the widths first. It moves up when high-frequency power grows, so it tracks the apparent brightness of a signal.
Mean frequency of a spectrum weighted by power, from up to five bin frequencies and their non-negative powers (set unused powers to zero). For a PSD on unequal bins, multiply by the bin widths first. It needs a positive total power and one consistent band.
Calculator
- Total power, ΣP4 V²
- RMS spread about the centroid109 Hz
- Frequency of the strongest bin200 Hz
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- The centroid is at 225 Hz, pulled above the strongest bin by any power above it.
- A centroid is a single-number summary and hides the shape: two quite different spectra can share the same centroid, so always check the spread too.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing (Hz) | Local step | Change in result |
|---|---|---|---|---|---|---|
| f2 Frequency of bin 2 | 0 to 100,000 Hz | 125 | 50,130 | 50,000 | +10% | +4.44 % |
| f1 Frequency of bin 1 | 0 to 100,000 Hz | 200 | 25,200 | 25,000 | +10% | +1.11 % |
| f3 Frequency of bin 3 | 0 to 100,000 Hz | 125 | 25,130 | 25,000 | +10% | +4.44 % |
| P3 Power of bin 3 | 0 to 1,000 V² | 166.7 | 399.3 | 232.6 | +10% | +1.9 % |
| P4 Power of bin 4 | 0 to 1,000 V² | 225 | 399.3 | 174.3 | +10% | 0 % |
| P5 Power of bin 5 | 0 to 1,000 V² | 225 | 399.3 | 174.3 | +10% | 0 % |
| P1 Power of bin 1 | 0 to 1,000 V² | 100.5 | 266.7 | 166.2 | +10% | −1.36 % |
| P2 Power of bin 2 | 0 to 1,000 V² | 200.1 | 250 | 49.9 | +10% | −0.529 % |
| f4 Frequency of bin 4 | 0 to 100,000 Hz | 225 | 225 | 0 | +10% | 0 % |
| f5 Frequency of bin 5 | 0 to 100,000 Hz | 225 | 225 | 0 | +10% | 0 % |
Sweep of Power of bin 3
| Power of bin 3 (V²) | Spectral centroid (Hz) |
|---|---|
| 0 | 166.7 |
| 125 | 394.5 |
| 250 | 397.2 |
| 375 | 398.1 |
| 500 | 398.6 |
| 625 | 398.9 |
| 750 | 399.1 |
| 875 | 399.2 |
| 1,000 | 399.3 |
Sweep one variable
Variables and how each one contributes
Spectral centroid
What the equation gives you. Everything else feeds it.
Frequency of bin 1
The frequency of bin 1, in Hz. Moves the centroid towards this bin in proportion to its power. Raising it by 10 % (to 110) moves the result by +1.11 %, from 225 to 227.5 Hz.
Frequency of bin 2
The frequency of bin 2, in Hz. Moves the centroid towards this bin in proportion to its power. Raising it by 10 % (to 220) moves the result by +4.44 %, from 225 to 235 Hz.
Frequency of bin 3
The frequency of bin 3, in Hz. Moves the centroid towards this bin in proportion to its power. Raising it by 10 % (to 440) moves the result by +4.44 %, from 225 to 235 Hz.
Frequency of bin 4
The frequency of bin 4, in Hz. Moves the centroid towards this bin in proportion to its power. Raising it by 10 % (to 440) moves the result by +0 %, from 225 to 225 Hz.
Frequency of bin 5
The frequency of bin 5, in Hz. Moves the centroid towards this bin in proportion to its power. Raising it by 10 % (to 440) moves the result by +0 %, from 225 to 225 Hz.
Power of bin 1
The power of bin 1. A larger power pulls the centroid towards this bin’s frequency. Raising it by 10 % (to 1.1) moves the result by −1.36 %, from 225 to 222 Hz.
Power of bin 2
The power of bin 2. A larger power pulls the centroid towards this bin’s frequency. Raising it by 10 % (to 2.2) moves the result by −0.529 %, from 225 to 223.8 Hz.
Power of bin 3
The power of bin 3. A larger power pulls the centroid towards this bin’s frequency. Raising it by 10 % (to 1.1) moves the result by +1.9 %, from 225 to 229.3 Hz.
Power of bin 4
The power of bin 4. A larger power pulls the centroid towards this bin’s frequency. Raising it by 10 % (to 0) moves the result by +0 %, from 225 to 225 Hz.
Power of bin 5
The power of bin 5. A larger power pulls the centroid towards this bin’s frequency. Raising it by 10 % (to 0) moves the result by +0 %, from 225 to 225 Hz.
Worked example with the values above
- Weighted sum: Σ f P = 900.
- Total power: Σ P = 4.
- fc = 900 / 4 = 225 Hz.
Assumptions and limits
- A stationary signal with a tone of constant amplitude and frequency, and a record that holds a whole number of cycles for the coherent formulas.
- A single, well-isolated spectral peak for interpolation, and a bandwidth that is stated.
Common mistakes
- Using these coherent formulas on a record with a non-integer number of cycles.
- Adding noise or a DC offset into the harmonic sum.
- Using a peak that is not the largest of its three neighbouring bins in the parabolic interpolation.
Statistics and uncertainty
Tone amplitude and phase from a single FFT line are accurate to a fraction of a per cent only for a coherent record; for a non-coherent tone, scalloping loss of up to 3.9 dB (rectangular window) or 1.4 dB (Hann) adds error unless it is corrected.
Where it is used
- Measuring amplitude, phase and distortion of tones in an FFT record.
- Refining a frequency estimate without a longer record.
Maths you need
- Coherent sampling: a whole number of signal cycles in the record
- Spectral peak: a local maximum in the spectrum
- Parseval’s theorem: power in the time domain equals power in the frequency domain