0
0
RosConceptBeginner · 3 min read

Power Spectral Density in Signal Processing Explained

In signal processing, power spectral density (PSD) shows how the power of a signal is distributed over different frequency components. It helps identify which frequencies carry the most energy in a signal.
⚙️

How It Works

Imagine you have a song playing, and you want to know which musical notes (frequencies) are the loudest. Power spectral density (PSD) does something similar for any signal. It breaks down the signal into its frequency parts and measures how much power or energy each frequency has.

Think of PSD as a map that tells you where the signal’s energy lives across frequencies. Instead of just looking at the signal over time, PSD looks at it in the frequency world, showing which parts are strong or weak. This is useful because many signals have hidden patterns or noise that are easier to understand when viewed by frequency.

💻

Example

This example shows how to calculate and plot the power spectral density of a simple signal made of two sine waves with different frequencies.

python
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import welch

# Create a sample signal: sum of two sine waves
fs = 500  # Sampling frequency in Hz
T = 2     # Duration in seconds
t = np.linspace(0, T, int(fs*T), endpoint=False)

# Frequencies of the sine waves
f1, f2 = 50, 120
signal = np.sin(2 * np.pi * f1 * t) + 0.5 * np.sin(2 * np.pi * f2 * t)

# Calculate power spectral density using Welch's method
frequencies, psd = welch(signal, fs, nperseg=512)

# Plot the PSD
plt.figure(figsize=(8, 4))
plt.semilogy(frequencies, psd)
plt.title('Power Spectral Density of Signal')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Power/Frequency (dB/Hz)')
plt.grid(True)
plt.show()
Output
A plot showing two clear peaks in power at 50 Hz and 120 Hz frequencies.
🎯

When to Use

Power spectral density is useful when you want to understand the frequency content of signals in many fields. For example:

  • In audio processing, to find dominant tones or noise.
  • In communications, to analyze signal bandwidth and interference.
  • In mechanical engineering, to detect vibrations or faults in machines.
  • In neuroscience, to study brain wave frequencies.

PSD helps identify which frequencies carry important information or unwanted noise, guiding filtering or further analysis.

Key Points

  • PSD shows how signal power is spread across frequencies.
  • It helps reveal hidden patterns not visible in time domain.
  • Welch’s method is a common way to estimate PSD from data.
  • PSD is essential for noise analysis, system diagnostics, and signal characterization.

Key Takeaways

Power spectral density reveals how signal power distributes over frequency.
It is useful for identifying dominant frequencies and noise in signals.
Welch’s method is a popular technique to compute PSD from sampled data.
PSD helps in audio, communications, mechanical, and neuroscience applications.