0

Inspired by this post and this video I have been playing around with different methods in Matlab to do spectral analysis. In the past I have simpy used digital fourier transforms and played around with different window types, window lengths, step sizes and averaging. Now I compared for different signals that approach with the "filter-bank"-method decribed in the video and with the "Wavelet synchrosqueezed transform".

With y being a time signal with sample rate Fs and x being a number of subsamples of y, one can calculate the DFT of this subset x. After the DFT calculation x is shifted for a certain sample-number called step and the DFT calculation is repeated. If this is done multiple times the time signal y can be transformed into multiple spectra. The frequency resolution of each spectra would be matched by the number of samples in x. The more samples, the higher the frequency resolution, but the lower the time resolution. The time resolution can be a bit improved by reducing the step-size but there is a limit. I tried to compare three methods:

1. Wavelet synchrosqueezed transform: Link

[sst,f] = wsst(y,Fs);

2. DFT:

hannEstimator = dsp.SpectrumEstimator('PowerUnits',"dBm",...
  'Window',"Hann",'FrequencyRange',"onesided",...
  'SpectralAverages',numAvgs,'SampleRate',Fs);

i=0; FFT=[]; while (istep+FrameSize)<=length(y) x=y((istep+1):(i*step+FrameSize)); Pse_hann = hannEstimator(x); FFT(:,i+1)=Pse_hann; i=i+1 end

3. Filter-Bank method: Link

filterBankEstimator = dsp.SpectrumEstimator('PowerUnits','dBm',
   'Method','Filter bank','FrequencyRange','onesided',
   'SpectralAverages',numAvgs,'SampleRate',Fs);`

i=0; HSA=[]; while (istep+FrameSize)<=length(y) x=y((istep+1):(i*step+FrameSize)); Pfb = filterBankEstimator(x); HSA(:,i+1)=Pfb; i=i+1 end

As can be seen the Wavelet synchrosqueezed transform doesn't need step and the subsamples x. Instead the resulting matrix sst has as many samples along the time-axis as the original time-signal y. For method 2 & 3 the variable FrameSize is relevant to tune time vs frequency resolution.

I tried multiple test-signals:

Voice saying "Matlab"

load mtlb
dt = 1/Fs;
t = 0:dt:numel(mtlb)*dt-dt;
y=mtlb;

Matlab speech The "High Spectral Analysis (HSA) / Filter Bank"-method seems to have a bit of a higher resolution compared to FFT, but there is also a delay introduced.

Chirp

load quadchirp;
y=quadchirp';
t=tquad;

Chirp

The synchrosqueezed transform looks great, but the Filter-bank method looks odd.

Multiple Tones

FrameSize = 420;
Fs = 1;
NoiseVar = 1e-10;
Sineg = dsp.SineWave('SampleRate',Fs,...
    'SamplesPerFrame',FrameSize,...
    'Frequency',[0.16 0.2 0.205 0.25],...
    'Amplitude',[2e-5 1  0.05  0.5]);
y=[];
t=[];
for i = 1:1000
    y = [y; sum(Sineg(),2)+sqrt(NoiseVar)*randn(FrameSize,1)];
end
t=0:1:(length(y)-1);

Multiple Tones

The synchrosqueezed transform looks very odd. The Filter-bank method seems to work best besides the weird stuff happening at the beginning.

2nd Chirp

load quadchirp;
y=quadchirp';
t=tquad;

2nd Chirp

The synchrosqueezed transform has a very high resolution in time and frequency. The Filter-bank method is doing worse than the FFT.

Recording E-Motor

Recording E-Motor FFT looks the most clean.

2nd Recording E-Motor

2nd Recording E-Motor FFT looks the most clean. Because of the long recording time and the huge numbers of spectra generated with the synchrosqueezed transform I didn't plot it.

After these examples I am quite disappointed about the Filter-bank method and also a bit about the synchrosqueezed transform. I wonder if I have missed some parameters to tune the results? In all examples I used the same values for step and for FrameSizefor DFT and Filter-bank. Also the value numAvgs was always the same for both. Further I played a bit around with the value NumTapsPerBand for the filter-bank method. But that didn't help much either.

Matthias La
  • 380
  • 2
  • 9

0 Answers0