poctave results differ depending on PSD or time signal input

7 views (last 30 days)
I am doing fractional octave analysis using poctave.
poctave will take either a time signal or a positive power spectrum, such as calculated by pwelch.
(My example code file is attached. It analyzes a synthesized mixed sines/noise signal and an audio sample loaded from a file.)
I am wondering why the results are different depending on whether I feed poctave a time signal or PSD. Here I created a 5-second signal consisting of several sinusoids with added gaussian noise. The noise energy spectrum is flat as expected, and the third octave spectrum rises with frequency as one would expect. The sine components are clearly visible in the log spectrum calculated from pwelch's pxx output:
sine analysis
However, the third octave bands are very different depending on whether poctave took a time signal or PSD as input. While they're mostly parallel-shifted, there are spectral differences.
Why is this the case?
If I use a short, real-world audio sample (background noise from a bar in this case), the bevavior is similar:
noise analysis

Accepted Answer

Frantz Bouchereau
Frantz Bouchereau on 20 Feb 2024
Edited: Frantz Bouchereau on 20 Feb 2024
Hi Roman, poctave expects a power spectral density as an input but you are computing power spectrum in your code.
In your calls to pwelch you are using the 'power' flag instead of the 'psd' flag.
Please try your script with the updated flag.
Thanks
  3 Comments
Frantz Bouchereau
Frantz Bouchereau on 20 Feb 2024
Edited: Frantz Bouchereau on 20 Feb 2024
Thanks for updating the code Roman,
The differences between the two methods are expected.
poctave with a time signal input uses actual bandpass filters (designed according to the ANSI S1.11 standard) to compute power at each octave band. Depending on the order of the bandpass filters you have some slight power bleeding between bands. The higher the filter order the less power bleeding, with the tradeoff being filter stability at the lower octave bands. Also higher filter orders will increase the stopband attenuation that will reduce the power differences due to noise contributions.
poctave with a psd input computes power over bands by integrating the frequency bins that fall within each band (taking care of only adding partial power over bins that contain frequencies of contiguous band edges). The power estimates will be affected by the way you compute the PSD:
  • The window type and window overalp you use will affect the amount of power bleeding of tones to contiguous bands.
  • The window size, as you mentioned, can lead to more or less averaging which affects the variance of the spectral estimate and hence of the power estimates at each octave band.
Hope this helps.

Sign in to comment.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!