Power Spectrum Calculator

Turn raw samples into a clean spectrum fast. Pick windows, scaling, and frequency limits easily. See dominant tones, noise floors, and bandwidth instantly now.

Used to map bins to frequency: f = k·fs/N.
Windows reduce leakage by tapering the signal edges.
Detrending prevents low-frequency drift dominating the spectrum.
Padding refines frequency spacing without adding new information.
PSD approximates power per hertz; spectrum is per bin.
One-sided doubles interior bins for real-valued series.
Limit outputs to a band of interest.
Shows the strongest bins within your range.
Use uniform sampling. Provide samples only; time axis is derived from the sampling frequency.

Example Data Table

This short sample approximates a single tone. Replace it with your own measurements for realistic spectra.
Index Sample Value Comment
00.0000Start
10.3090Rising
51.0000Near peak
100.0000Crossing
15-1.0000Near trough
19-0.3090End
Set sampling frequency to 20 Hz for this example.

Formula Used

The discrete transform for bin k uses:

X[k] = Σ x[n] · e^{-j2πkn/N}, for n = 0..N-1.

Magnitude-squared power is:

|X[k]|² = Re(X[k])² + Im(X[k])².

This tool offers two common scalings:

  • Power spectral density: P[k] = |X[k]|² / (N·fs) (approx. per hertz).
  • Power spectrum: P[k] = |X[k]|² / N² (per bin).

For one-sided output of real signals, interior bins are doubled to preserve total power.

How to Use This Calculator

  1. Paste your uniformly sampled values into the samples box.
  2. Enter the sampling frequency in hertz.
  3. Choose a window to reduce spectral leakage.
  4. Select detrending to remove offsets or drift.
  5. Pick a scaling mode and output units.
  6. Optionally set a frequency range and peak count.
  7. Press Calculate to view the spectrum above.
  8. Use the download buttons to export results.
Professional Article

1) What a power spectrum reveals

A power spectrum describes how a signal’s energy is distributed across frequency. In vibration, you can spot rotating components by their tone frequency. In audio, harmonics show timbre. In electronics, spurs reveal interference. This calculator converts sample values into frequency bins so you can compare peaks and broadband noise objectively.

2) Sampling frequency and the Nyquist limit

The sampling frequency fs sets the highest resolvable frequency. For real-valued signals, the one-sided view runs from 0 to fs/2 (Nyquist). For example, fs = 2000 Hz captures content up to 1000 Hz. Any higher-frequency content folds back as aliasing, so use proper acquisition filtering.

3) Frequency resolution and FFT length

Bin spacing is Δf = fs / N, where N is the transform length after padding. With fs = 1000 Hz and N = 1024, Δf ≈ 0.9766 Hz. Smaller Δf helps separate nearby tones, but it does not add new information unless you also record more samples.

4) Why windowing matters

If a tone does not fall exactly on a bin center, its energy “leaks” into adjacent bins. Window functions (Hann, Hamming, Blackman) taper endpoints to reduce leakage. Rectangular window preserves amplitude best for coherent sampling, but can spread energy widely when the record is not an integer number of cycles.

5) Detrending for reliable low-frequency results

Offsets and slow drifts inflate the 0–few hertz region. Removing the mean suppresses DC bias. Removing a linear trend suppresses ramp-like drift that otherwise dominates the lowest bins. If you are analyzing very low-frequency phenomena, consider leaving detrending off and managing drift at the measurement stage.

6) Spectrum versus power spectral density

This tool provides two common scalings. A power spectrum reports power per bin, useful for identifying dominant tones. A power spectral density (PSD) approximates power per hertz, which is better for comparing noise floors across different N values. PSD units are typically “signal²/Hz”.

7) Linear and dB output for interpretation

Linear output preserves raw magnitudes and is convenient for engineering calculations. dB output compresses large dynamic ranges: 10·log10(P). For example, a 10× increase in power corresponds to +10 dB. dB views make weak tones visible beside strong carriers.

8) Practical workflow and peak reporting

Start by setting fs, selecting a window, and choosing mean removal for typical sensor data. Use one-sided output for real signals. Limit the frequency range to your band of interest and request several peaks. The peak table ranks bins by magnitude, helping you document dominant frequencies quickly.

FAQs

1) What sample spacing does this calculator assume?

It assumes uniform sampling. Enter only sample values and provide the sampling frequency. If the time steps vary, resample to a uniform grid first for meaningful frequency bins.

2) Why do I see a huge value near 0 Hz?

A strong DC offset or slow drift concentrates energy at very low frequencies. Try “Remove mean” or “Remove linear trend,” and ensure your sensor chain is not saturating.

3) Does zero padding increase accuracy?

Zero padding increases the number of displayed bins and smooths the curve, but it does not add new information. True resolution improves when you collect more samples.

4) Which window should I choose?

Hann is a strong default for general analysis. Hamming can give slightly narrower main lobes. Blackman provides stronger sidelobe suppression for leakage-heavy cases, at the cost of wider peaks.

5) When should I use PSD instead of spectrum?

Use PSD to compare noise floors between measurements with different record lengths. Use spectrum when you mainly care about identifying and ranking dominant tones.

6) What does one-sided output change?

For real-valued signals, one-sided output shows 0 to Nyquist and doubles interior bins to conserve total power. Two-sided output keeps both positive and negative frequencies.

7) Why does the strongest peak frequency look slightly off?

The peak is reported at the nearest bin center. Increase recorded samples to reduce Δf, or use padding for a smoother plot. For precise estimation, apply peak interpolation techniques.

Related Calculators

Network degree calculatorAverage path length calculatorClustering coefficient calculatorBetweenness centrality calculatorCloseness centrality calculatorEigenvector centrality calculatorPageRank score calculatorKatz centrality calculatorAssortativity coefficient calculatorModularity score calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.