-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Thank you for open-sourcing this.
Looking at definition of analytic signals, I've noted the transform from real to analytic to be s(t) -> s(t) + js^(t), i.e. the real part is preserved. For even lengths, however, as per Hilbert transform, this requires us to halve the dc and Nyquist bins (or double others):
N = length(x); # try any even-length x
xf = fft(x);
xfa = horzcat(xf(1), 2*xf(2:N/2), xf(N/2+1), zeros(1, N/2-1));
xa = ifft(xfa); # real(xa) == real(x)Here is tail behavior comparison of original and adjusted time-domain wavelets (psi):
Adjusted properly decays to zero; this enables stable and accurate computation of wavelet time resolution for low scales (otherwise t**2 in variance integral won't bound).
However, another point of concern: there is no Nyquist bin: psif(N/2+1) == 0. Whether the bin belongs to positives or seems arbitrary, but in terms of basis functions the two are equivalent so one might say "both", where again it makes sense to halve it to "zero the negative half". More importantly the code above fails to yield real(xa) == real(x) without it. Above plots were produced without Nyquist bin; I've yet to investigate behavior with vs without, will update.
