Why is this the requirement for stftmag2sig's input signal and reconstructed signal to be same length? length(x)-​noverlap)/​(length(wi​ndow)-nove​rlap) = integer

4 views (last 30 days)
Why is it that "if you want x (original signal) and s (reconstructed signal) to be the same length, the value of (length(x)-noverlap)/(length(window)-noverlap) must be an integer. Use Window to specify the length of window and OverlapLength to specify noverlap" for the stftmag2sig function? This quote was taken directly from the stftmag2sig documentation, which you can find at the following link:

Accepted Answer

Vinay
Vinay on 17 Jun 2025
Hi @Paige,
The Short time fourier transform(STFT) splits the signal(x) into overlapping segments and reconstruct the original signal by adding the transformed segments.
The STFT divides 'x' into overlapping frames/windows. The number of frames depends on:
  • Length of 'x'
  • Window length
  • Amount of overlap('noverlap')
The number of frames is approximately:
When the number of frames is an integer, the signal x is perfectly segmented using the specified window and overlap. If not, the last frame is partial or padded, leading to a reconstructed signal that differs in length from the original.
Example
  • Window length = 128 samples
  • Overlap (noverlap) = 96 samples (which is 75% overlap)
Case 1: length(x) = 1024
The ratio is 29, so the STFT divides the signal into 29 complete overlapping windows, allowing accurate reconstruction with the original signal length.
Case 2: length(x) = 1000
The ratio is 28.25, resulting in an incomplete final window that requires padding or truncation. As a result, the reconstructed signal may be shorter or longer than the original.
I hope this resolves the query.​

More Answers (0)

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!