See my remarks about "too close to zero" above. The logarithm of a zero is -inf (or I guess the point at infinity for the complex case). The fix is to add a small bias that is large enough that the logarithm doesn't get large enough to actually cause mayhem. Something like 1e-10 (= -200dB) should usually be workable in double precision, though making it slightly bigger (eg. 1e-6 maybe) can reduce rounding errors in the FFTs when you're (probably) not trying to get 200dB SNR anyway.I'm SO CLOSE but I'm getting overflow errors at the last step!!!((
Once you actually get results and they don't look right.. there's a slight detail I skipped: if you're just zeroing the negative offsets without touching the positive ones, you might need to multiply the DC-bin and the Nyquist-bin (or offset 0 and N/2 depending on how you look at it) by 0.5 'cos in a sense they are half positive- and half negative-side.
Statistics: Posted by mystran — Thu Feb 15, 2024 12:15 pm