Spectral Density Tool Calculator

Turn raw signal samples into interpretable frequency insights. Choose windows, segments, and overlaps in seconds. Export charts, CSV, and PDF summaries with one click.

Calculator

Use your acquisition rate, for example 1000.
Welch reduces variance using overlapping windows.
Density approximates power per Hz.
Windows trade resolution for leakage control.
Detrending reduces artificial low-frequency energy.
Typical: 128–2048 samples. Ignored by periodogram.
Common: 50%. Higher overlap increases averaging.
Auto selects next power of two at least segment length.
For band power integration.
Swap is handled automatically if reversed.
Tip: Values can be pasted from spreadsheets or logs.
Reset

Example data table

Index Sample value Notes
00.08Short segment of a noisy sine-like signal.
10.62In real work, provide hundreds to thousands samples.
21.04Use consistent units across your measurement pipeline.
30.76Higher rates help capture higher-frequency behavior.
40.12Detrending removes offsets and slow drifts.
Use the “Load example dataset” button to populate the input quickly.

Formula used

Core steps
  • Detrend samples to reduce artificial low-frequency power.
  • Apply a window to control spectral leakage.
  • Compute the discrete Fourier transform using FFT.
  • Convert magnitudes to a one-sided spectrum for real signals.
  • Average segment spectra for the Welch method.
Equations

Windowed segment: x_w[n] = (x[n] - trend) · w[n]

FFT: X[k] = Σ x_w[n] · e^{-j2πkn/N}

Window power normalization: U = (1/N) Σ w[n]^2

Spectral density (one-sided): Pxx[k] = (2 · |X[k]|^2) / (Fs · U · N^2)

The factor 2 is applied to interior bins only, preserving DC and Nyquist energy.

How to use this calculator

  1. Enter the sampling frequency that matches your data capture rate.
  2. Paste your time series samples using commas, spaces, or new lines.
  3. Select Welch for smoother estimates, or periodogram for a single pass.
  4. Choose a window and detrending to match your signal characteristics.
  5. Set segment length, overlap, and FFT length, then calculate.
  6. Review peak frequency, total power, and band power metrics.
  7. Download CSV for spreadsheets or PDF for reports and sharing.

Sampling rate and frequency resolution

Spectral density is only as accurate as the sampling plan. With a sampling frequency Fs, the highest observable frequency is the Nyquist limit Fs/2, so Fs=800 Hz covers content up to 400 Hz. Resolution is approximately Fs/NFFT, so Fs=1000 Hz and NFFT=2048 yields about 0.488 Hz bin spacing. Zero padding can smooth plots but does not add new information. Use anti-alias filtering when the sensor sees higher frequencies.

Welch averaging reduces variance

A single periodogram can fluctuate heavily, even for stable signals. Welch splits the series into segments, applies a window, and averages spectra to stabilize the estimate. For example, a 4096-sample record with 1024-point segments and 50% overlap produces seven segments, improving repeatability while keeping detail. More segments increase averaging but reduce low-frequency resolution, so match settings to your objective.

Window choice and leakage control

Windows trade resolution for leakage suppression. Hann is a strong general choice; Hamming keeps a slightly narrower main lobe; Blackman suppresses sidelobes further for noisy environments. The calculator normalizes by window power U so values remain comparable across selections and segment lengths. This normalization supports one‑sided scaling for real-valued data while preserving DC and Nyquist energy.

Interpreting peaks, bands, and total power

Peaks often indicate periodic components such as rotation, switching, or oscillation. Band power integrates Pxx over a frequency range, which is useful for compliance limits or feature engineering. If a peak is at 60 Hz, consider harmonics at 120 Hz and 180 Hz and verify with the peak table. Total power estimates the overall signal energy per unit time; compare it before and after filtering to quantify improvement.

Practical checks before exporting results

Confirm units: if samples are volts, Pxx is V²/Hz; if samples are g, Pxx is g²/Hz. Remove offsets with detrending when low-frequency drift is not meaningful. Ensure segment length captures several cycles of expected tones; for a 10 Hz component, 1024 points at 200 Hz spans 5.12 s, usually adequate. Overlap between 25% and 75% is common; higher overlap increases computation but can stabilize estimates. Export CSV for analysis and PDF for reporting and audit trails. Always document your settings to support reproducible comparisons.

FAQs

1) What does the spectral density output represent?

The output estimates how signal power is distributed across frequency, using a one-sided PSD for real data. It helps you find dominant tones, broadband noise levels, and energy inside specific frequency bands.

2) When should I choose Welch instead of periodogram?

Choose Welch when you need a steadier estimate with lower variance, especially for noisy measurements. Use periodogram for quick inspection or when you want maximum frequency detail from a single FFT pass.

3) How do segment length and overlap affect results?

Longer segments improve low-frequency resolution but reduce the number of averages. Overlap increases the number of segments without collecting more data, improving stability at the cost of extra computation and sometimes more correlation between segments.

4) Why use detrending before computing PSD?

Detrending removes mean offsets or slow drifts that can inflate power near 0 Hz. This makes the spectrum easier to interpret when the DC component is not physically meaningful for your analysis.

5) What causes spectral leakage and smeared peaks?

Leakage occurs when a periodic component does not fit an integer number of cycles inside a segment, spreading energy into nearby bins. Selecting an appropriate window and using longer segments typically reduces leakage and sharpens peaks.

6) What units should I expect in the PSD and power metrics?

PSD units are “(signal unit)² per Hz”, such as V²/Hz or g²/Hz. Total power is the integral of PSD across frequency, returning squared signal units, and band power reports the same within your selected band.

Related Calculators

Holt Winters ToolDifferencing CalculatorAnomaly Detection ToolFourier Transform ToolChange Point DetectorGranger Causality ToolState Space Model

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.