TimeFrequency Transforms: STFT vs Wavelets
Prince E. Adjei
Kwame Nkrumah University of Science and Technology
Topic: TimeFrequency Transforms Module 4: Advanced Topics
Biosignal Processes And Analysis (BME 366)
© 2025 Prince E. Adjei
Topics
(1). TimeFrequency Analysis Basics
(2). Short-Time Fourier Transform (STFT)
(3). Wavelet Transform
(4). Wavelet Bases
(5). Wavelet Application
TimeFrequency Transforms: STFT vs Wavelets
Learning Objectives
Describe the need for timefrequency analysis in processing non-
stationary biomedical signals.
Compare the Short-Time Fourier Transform (STFT) and Wavelet
Transform in terms of resolution and adaptability.
Interpret wavelet basis functions such as Haar and Daubechies,
including their orthogonality and structure.
Apply Discrete and Continuous Wavelet Transforms (DWT/CWT) to
analyze and process biomedical signals.
Use wavelet-based methods for tasks such as denoising and systolic
peak detection in signals like PPG.
Review
Time domain shows how a signal changes over time.
Useful for identifying peaks, durations, and intervals (e.g., R-peaks in ECG).
Provides a direct and intuitive view of the signal’s shape.
Ideal for detecting event timing and analyzing waveform patterns.
Frequency domain shows which frequencies are present in the signal and how
strong they are.
Useful for uncovering hidden rhythms, periodic components, or noise.
Achieved using tools like the Fourier Transform or Power Spectral Density
(PSD).
Ideal for analyzing spectral content and understanding how energy is
distributed.
Time-Frequency Transforms
Many biosignals like ECG, EEG, and PPG are non-stationary, meaning
their frequency content changes over time.
Traditional Fourier Transform gives global frequency information but
loses all time localization.
It tells you what frequencies exist, but not when they occur.
In real-world biomedical signals, important events (e.g., arrhythmias,
muscle bursts) are transient ; they happen for a short duration and may
not be visible in a full-spectrum view.
Time-Frequency Transforms
TimeFrequency analysis solves this by combining both domains:
It shows how frequency content evolves over time.
Helps in identifying dynamic signal behavior, detecting artifacts, or
understanding physiological changes.
Common timefrequency tools include:
Short-Time Fourier Transform (STFT) uses sliding windows.
Wavelet Transform uses variable-resolution windows for better
adaptability.
Short-Time Fourier Transform (STFT)
STFT analyzes a non-stationary signal by dividing it into short, fixed-length
windows, then applying the Fourier Transform to each window.
Strengths
Provides both time and frequency information.
Simple and widely used easy to implement.
Works well when signal changes are slow or moderate.
Limitations
Has constant resolution:
Fixed window size = fixed trade-off between time and frequency resolution.
Anarrow window gives good time resolution but poor frequency resolution.
Awide window gives good frequency resolution but poor time resolution.
Not ideal for signals with both fast and slow changes, like many biosignals.
Continuous-Time STFT
The Continuous-Time STFT is a mathematical way to look at how the
frequencies in acontinuous signal change over time.
It slides a window over the signal and applies the Fourier Transform to just
that small part.
This shows what frequencies are present at each time point.
Mathematically:
x(τ): your signal
w(τ−t): the sliding window centered at time t
𝒆𝒋𝟐𝝅𝒇𝝉: the Fourier part (to analyze frequency f)
The Discrete-Time STFT is the digital version of STFT, used for analyzing
signals on a computer; like an ECG recorded as a list of values.
It takes short segments (windows) from a digital signal.
For each segment, it computes the Discrete Fourier Transform (DFT).
This shows what frequencies are present at each time step.
x[m]: the discrete signal
w[m−n]: the window centered at position n
𝒆𝒋𝟐𝝅𝒌𝒎/𝑵: computes the DFT at frequency bin k
N: total number of frequency bins (FFT size)
Discrete-Time STFT
The Wavelet Transform is a tool for analyzing signals whose properties
change over time but with one big advantage: variable-width Windows
Unlike STFT (which uses a fixed-size window), wavelets use:
Narrow windows for high-frequency components better time
resolution.
Wide windows for low-frequency components better frequency
resolution.
This gives adaptive resolution, making wavelets better for non-stationary
signals like ECG or EMG.
At each level, it separates the signal into:
Approximation (A) low-frequency components
Detail (D) high-frequency components
Wavelets
Step-by-Step Breakdown
1. Filtering
The signal is passed through two filters:
A low-pass filter (LPF) keeps slow-changing parts (approximation).
A high-pass filter (HPF) keeps fast-changing parts (detail).
2. Downsampling
After filtering, the outputs are downsampled by 2(keep every second
sample) to reduce redundancy.
So after one level, we get:
A₁ (approximation at level 1) and D₁ (detail at level 1)
3. Recursive Decomposition
The process is repeated on the approximation only:
A₁ LPF + HPF A₂ and D₂ and so on
Wavelets
1.Why is timefrequency analysis
important for non-stationary signals
like PPG or ECG?
2.What trade-off does the Short-Time
Fourier Transform (STFT) face when
selecting a window size?
3.How do Haar and Daubechies
wavelets differ in terms of
smoothness and signal
representation?
4.What is the main advantage of
wavelet transforms over STFT in
analyzing biosignals?
Questions
Wavelet transforms use small “wave-like” functions (called mother
wavelets) to analyze signals at different scales. Two common families are
Haar and Daubechies.
1. Haar Wavelet
Simplest wavelet: looks like a step function.
It's like a square pulse ; sharp and localized in time.
Great for capturing sudden changes, edges, or spikes.
Fast and efficient, but not smooth can introduce blocky artifacts.
2. Daubechies
Smoother and more complex than Haar better at capturing gradual
changes.
db2is the simplest, db4, db6, etc., give better frequency localization but are
longer.
Haar and Daubechies
Haar and Daubechies
Haar and Daubechies
Feature
Haar
Daubechies
Shape
Step
-like (square wave)
Smooth and oscillatory
Time resolution
Excellent (very localized)
Good
Frequency resolution
Poor (blocky)
Better (smoother filtering)
Use case
Quick detection of edges/spikes
Denoising, ECG features, smooth
signals
Orthogonal wavelets form a complete, non-overlapping basis.
This means:
No redundancy: each component (detail or approximation) is unique.
Perfect reconstruction: you can fully recover the original signal from
its wavelet coefficients.
Both Haar and Daubechies wavelets are orthogonal, making them suitable
for:
Lossless signal analysis
Efficient storage
Exact inverse transforms
Orthogonality
The DWT breaks a signal into different frequency bands using wavelet filters.
It separates the signal into two components at each level:
Approximation (A) low-frequency part
Detail (D) high-frequency part
This process is repeated only on the approximation to get a multilevel
breakdown.
Multilevel Decomposition
At Level 1, the signal is split into:
A1 (approximation)
D1(detail)
At Level 2, the approximation A1 is split again: A2, D2
This continues for multiple levels:
Level 3 A3,D3
Level 4 A4,D4 and so on.
Discrete Wavelet Transform (DWT)
Example (4-level DWT):
Each level gives finer time resolution for high frequencies (D components)
and better frequency resolution for low frequencies (A components).
Discrete Wavelet Transform (DWT)
Discrete Wavelet Transform (DWT)
Discrete Wavelet Transform (DWT)
The CWT analyzes a signal by convolving it with scaled and shifted versions
of a wavelet function.
Unlike DWT, CWT works over a continuous range of scales and positions,
giving smooth, high-resolution timefrequency analysis.
Morlet Wavelet
A commonly used continuous wavelet transform (CWT)(sine wave multiplied
by a Gaussian).
Good for analyzing oscillatory signals like PPG, EEG, EMG.
Looks like a short wave packet ideal for timefrequency analysis.
Mathematical form:
f0: central frequency
Combines time localization (Gaussian) and frequency sensitivity (sine wave)
Continuous Wavelet Transform (CWT)
Scale to Frequency Conversion
In CWT, you analyze the signal at different scales (a) but we often want to
know the corresponding frequencies.
f: actual frequency
a: scale
fc: center frequency of the wavelet
So:
Small scale → high frequency
Large scale → low frequency
Continuous Wavelet Transform (CWT)
1.How are Haar and Daubechies
wavelets different?
2.What does DWT do to a signal at
each level?
3.What does the Morlet wavelet help
with in CWT?
4.How is scale related to frequency
in CWT?
Questions
PPG (Photoplethysmogram) signals often contain noise from:
Motion artifacts
Powerline interference (50/60 Hz)
Baseline wander
Wavelet denoising removes high-frequency noise while preserving sharp
systolic peaks.
Wavelet Denoising Steps (DWT-based):
1.Decompose signal using DWT into A + D coefficients.
2.Threshold the detail coefficients (D) to suppress noise.
3.Reconstruct the signal using the modified coefficients.
Denoising for PPG
Denoising for PPG
The systolic peak in a PPG signal has a sharp rising edge (steep up-
slope).
The 1st level detail coefficients (D1) from a wavelet transform (like using
db4) capture high-frequency components, especially:
Sudden transitions
Sharp slopes
The positive peak in D1 corresponds to the fast up-slope of the systolic
wave.
Systolic Detection via Wavelet D1 (Up-Slope Method)
Step-by-Step Detection Strategy
1.DWT Decomposition:
Apply 1-level DWT to the PPG signal using a wavelet (e.g., db4).
Get the D1 coefficients.
2. Identify Rising Edges:
Look for positive peaks in D1 they indicate fast increases in the signal.
These often align with onsets of systolic waves.
3. Refine Detection:
Cross-reference with the original signal to:
Locate actual peaks
Filter out false positives (e.g., from noise)
Systolic Detection via Wavelet D1 (Up-Slope Method)
Systolic Detection via Wavelet D1 (Up-Slope Method)
Summary
Why TimeFrequency Analysis?
Biosignals like PPG and ECG are non-stationary
Require methods that show both time and frequency changes
STFT Strengths & Limitations
Uses a fixed-size window
Trade-off:better time or frequency resolution, not both
Good for signals with relatively constant frequencies
Wavelet Transform (DWT & CWT)
Uses variable window sizes: short for high freq, long for low
DWT:gives discrete levels (A1A4, D1D4)
CWT with Morlet: continuous scales, allows scale-to-frequency
conversion.
Summary
Wavelet Types Haar vs Daubechies
Haar: simple, sharp edges
Daubechies: smoother, better for real biosignals
Both are orthogonal, useful for decomposition and reconstruction
Applications
PPG Denoising: threshold high-frequency details
Systolic Detection: use D1 to find sharp up-slopes in PPG
Allows noise suppression and peak tracking in one framework