How to use this calculator
Describe where a real record places its spectral energy and how widely that energy is distributed.
- Enter Uniform samples (signal units), Sampling frequency (Hz). Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Power weighted spectral centroid and spread explained
Calculate the centroid and spread of one-sided DFT power for uniformly sampled real data.
A numerical walkthrough
Uniform samples (signal units) = [1, 0, -1, 0, 1, 0, -1, 0]; Sampling frequency (Hz) = 8.
- Power spectral centroid: 2 Hz
- RMS spectral spread: 2.24028108e-16 Hz
A pure coherent two-hertz tone gives a centroid of two hertz and nearly zero spread when sampled at eight hertz.
The model behind the numbers
fc=Σfk Pk/ΣPk; σf=√[Σ(fk−fc)²Pk/ΣPk] using the folded one-sided rectangular-block DFT power.
Power weighting differs from the common magnitude-weighted audio centroid; the weighting is explicit so results can be compared consistently. DC is retained.
What to enter
x— Uniform samples (signal units)- Enter one finite real sample per time step in chronological order; the record is uniformly sampled at fs.
fs— Sampling frequency (Hz)- Uniform samples per second; must be positive.
Interpreting the result
Short-block leakage, DC offsets and the chosen window strongly affect these moments. No perceptual loudness weighting.
Reading the outputs
Centroid and spread are in hertz; spread is a standard deviation of the discrete energy distribution.
Frequently asked questions
Why differ from a music-library centroid?
Some libraries weight amplitude magnitude rather than squared magnitude.
What does zero spread mean?
All measured one-sided power occupies one bin.
Should I subtract the mean?
Do so before entry when DC is irrelevant to the task.
How do I use the Power weighted spectral centroid and spread calculator?
Enter Uniform samples (signal units), Sampling frequency (Hz). Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Power weighted spectral centroid and spread?
Uniform samples (signal units) = [1, 0, -1, 0, 1, 0, -1, 0]; Sampling frequency (Hz) = 8. Power spectral centroid: 2 Hz RMS spectral spread: 2.24028108e-16 Hz A pure coherent two-hertz tone gives a centroid of two hertz and nearly zero spread when sampled at eight hertz.
Read our calculation methodology.