Formula for FWHM in frequency domain

236 views
Skip to first unread message

MSB

unread,
Aug 1, 2019, 3:25:42 AM8/1/19
to AnalyzingNeuralTimeSeriesData
Hi Mike,

Read you paper about reporting FWHM paper. I was trying to play around with the formulas, and something seems wonky.

Specifically, formula 8 - I understand it to represent the FWHM in the frequency domain, but the values do not match the values in figure 2. I guess that means the (1) formula 8 does not represent FWHM in the frequency domain or (2) I'm missing something?

I have to following - would appreciate any corrections:

Hz = 7;
n = 8;

% sigma in time-space
sig_t = n / (2 * pi * Hz)

% sigma in freq-space
sig_f = Hz / n

% FWHM in time-space
h = n * sqrt(n * log(2)) / (pi * Hz)

% FWHM in freq-space (????)
s = h * (2 * pi - 1) / (4 * pi)

% minimal cycles
n_min = pi / sqrt(2 * log (2))


Thanks!

Mattan

MSB

unread,
Aug 1, 2019, 7:51:28 AM8/1/19
to AnalyzingNeuralTimeSeriesData
Correction:
% FWHM in time-space
h = n * sqrt(2 * log(2)) / (pi * Hz)

Mike X Cohen

unread,
Aug 1, 2019, 11:26:09 AM8/1/19
to analyzingneura...@googlegroups.com
Hi Mattan. From my read, there are only 7 numbered equations in the paper. I checked equation 4, and that gave consistent results to figure 2. Or did you mean equation 7? In that case, h is the FWHM in the frequency domain, and s is the width parameter (not the same thing as the number of cycles in the time domain). Maybe you can rephrase your question?



--
You received this message because you are subscribed to the Google Groups "AnalyzingNeuralTimeSeriesData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzingneuraltimes...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/analyzingneuraltimeseriesdata/b847d475-658d-403c-acf3-592e05ee288a%40googlegroups.com.


--
Mike X Cohen, PhD
Fresh look: mikexcohen.com

MSB

unread,
Aug 1, 2019, 3:14:54 PM8/1/19
to AnalyzingNeuralTimeSeriesData
Hi Mike,

Sorry - I did mean formula 7! So let's try again:

1. Do I understand correctly that formula 4, h, is the FWHM in the time domain? (Seems to match the values in figure 2)
2. What is the formula for FWHM in the frequency domain? I thought it was formula 7, s, but its results don't match figure 2. If it's not s, could to point me in the right direction?

Thanks!

Mike X Cohen

unread,
Aug 2, 2019, 9:49:14 AM8/2/19
to analyzingneura...@googlegroups.com
Ah, makes sense ;)   h in eq 7 is the FWHM in the frequency domain, not in the time domain. Apologies if that was confusingly written in the paper. I guess I should have called them h_t and h_f (hindsight...) (but see also the explanation of eq 7 in the top-right of page 84 "h is the FWHM in Hz"). s is the width parameter that goes into the formula. The best way to interpret s is, well, not to interpret it. Analogously, in the time domain, you wouldn't interpret sigma; you'd interpret the number of cycles, which is part of the definition of sigma.



--
You received this message because you are subscribed to the Google Groups "AnalyzingNeuralTimeSeriesData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzingneuraltimes...@googlegroups.com.

MSB

unread,
Aug 2, 2019, 11:05:26 AM8/2/19
to AnalyzingNeuralTimeSeriesData
Ah, I some how missed that! Thanks!

Final question: I tried setting s to f / n, but I get values on a different scale than those in the two bottom-left panels in figure 2 - so I guess that's not the correct formula for s?

cyc = [3,8];
hz = 7;

s = hz ./ cyc; %?
h = s / ((2 * pi - 1) / (4 * pi));

h ./ [4, 1.5] % values from figure 2 (2 bottom left panels)

ans =

    1.3875    1.3875

Mike X Cohen

unread,
Aug 4, 2019, 11:41:01 AM8/4/19
to analyzingneura...@googlegroups.com
Hi Mattan. Again, that s in eq 7 is specified in the frequency domain, not in the time domain. It gets a bit tricky, but basically all the parameters are different in the time vs. frequency domains. In the frequency domain, you can compute s based on h, and that goes into eq 5. To find the time-domain FWHM, you would want to take the IFFT to get the frequency-domain Gaussian back into the time domain.

Mike



--
You received this message because you are subscribed to the Google Groups "AnalyzingNeuralTimeSeriesData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzingneuraltimes...@googlegroups.com.

MSB

unread,
Aug 4, 2019, 12:59:44 PM8/4/19
to AnalyzingNeuralTimeSeriesData
Hi Mike,

I think we're having a bit of an xy problem - totally my fault for asking the wrong questions.

What I really want is a formula that takes the frequency and the number of cycles and gives the two FWHMs (in the time and in the freq domain).
In the time domain I know from the paper that is it (f - frequency; n - number of cycles):
n * sqrt(2 * log(2)) / (pi * f)

But I can't seem to figure it out for for the frequency domain... :/
So I guess my question all along was: How do I convert number of cycles + frequency to the FWHM in the frequency domain?

Thanks again (and again) and sorry for the confusion!

Mattan

Mike X Cohen

unread,
Aug 4, 2019, 1:28:37 PM8/4/19
to analyzingneura...@googlegroups.com
Ah, I see. I actually recommend specifying it in one domain and computing it empirically in the other domain. That's also going to be more accurate, particularly if the Gaussian is narrow in one or tue other domain.

--
You received this message because you are subscribed to the Google Groups "AnalyzingNeuralTimeSeriesData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzingneuraltimes...@googlegroups.com.

MSB

unread,
Aug 4, 2019, 1:38:19 PM8/4/19
to AnalyzingNeuralTimeSeriesData
Right - but if I wanted to start from the frequency domain (as I care more about the frequency accuracy than the time accuracy in my wavelet analysis) using the frequency and number of cycles...?

The closest I've got to the values in figure 2 is:
(4 * pi * f) / (n * sqrt(2) * (2 * pi - 1))

Mike X Cohen

unread,
Aug 4, 2019, 3:15:33 PM8/4/19
to analyzingneura...@googlegroups.com
OK, I think I understand now ;)  What you'd have to do is take the inverse Fourier transform of the spectrum of the wavelet (analytically, not the discrete-time Fourier transform) and then solve for n. It gets pretty hairy and I'm not going to take the time to do it right now. Still, I think it's better to compute it empirically -- it's just a few lines of code and will be more accurate than the analytic solution. 



--
You received this message because you are subscribed to the Google Groups "AnalyzingNeuralTimeSeriesData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzingneuraltimes...@googlegroups.com.

MSB

unread,
Aug 5, 2019, 12:03:57 AM8/5/19
to AnalyzingNeuralTimeSeriesData
Got it - thanks Mike!
Reply all
Reply to author
Forward
0 new messages