What are the differences between the old and the new implementation of ‘wavelet’ (formerly ‘wltconvol’) in ft_freqanalyis?
Several things have changed in the new implementation of frequency analysis by the new low-level module ‘specest’.
- All output is now phase-shifted such that an angle of 0 of any fourier-coefficient always means a peak of an oscillation in the data, and an angle of pi/-pi will always mean the trough of an oscillation (wavelet wise angle = 0 is implemented as cosine at peak, and sine in up-going flank)
- ‘wavelet’ now uses an accurate frequency vector for building its wavelets (determined by fsample and nsample, with cfg.foi as starting point), instead of an uncorrected cfg.foi. In many cases this will cause frequencies like e.g. 4.0978 to show up in the output. This is not an inaccuracy, it is more precise labeling of the frequency content. This means that it is very important to make sure you zero-pad datasets to an equal length (using cfg.padding) that you want to compare later on: the output-foi must be identical (more information can be found here).
- The new implementation now correctly shifts the output by one single time-point compared to the old implementation. In the previous implementation, ‘wltconvol’, this was a sleeping bug.
- cfg.method = ‘fourier’ is now an appropriate output.