# Talk:Short-time Fourier transform

WikiProject Signal Processing
This article is within the scope of WikiProject Signal Processing, a collaborative effort to improve the coverage of signal processing on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
WikiProject Mathematics (Rated C-class, Mid-importance)
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
 C Class
 Mid Importance
Field:  Analysis

## Untitled

n is discrete but omega is continuous, which may be why it is sometimes written

${\displaystyle STFT[n,\omega )}$?

specgram is |stft|^2

http://www.ece.mcmaster.ca/~ibruce/courses/COE4TL4_lecture27.pdf

## Heisenberg uncertainty principle?

Now I hear that the resolution problem IS the same as the Heisenberg uncertainty principle, but i have read enough over there to know that they are not actually the exact same thing. a sound/voltage/whatever wave can have instantaneous frequency, for instance. Can someone who understands in depth please explain this? Omegatron 17:05, Feb 24, 2004 (UTC)

(as in these paragraphs on the HUP talk page):

"

That's not true. It is not the same theorem. Standard QM uncertaintaty relations are derived from a theorem about operators on a hilbert space. These are not things that occur in classical wave mechanics. This idea about frequency and intervals is what underscores the time-energy relations, which is precisly why I cautioned against talking about them in the same language as standard QM relations. -- Matthew
There is a theorem relating the "uncertainty" in a function and the uncertainty in its Fourier transform. In standard wave mechanics, the Fourier transform is a Hilbert space automorphism which translates between the position observable x and the momentum observable -i d/dx. So the Fourier theorem can actually be used to prove the space-momentum uncertainty relation. --AxelBoldt

"

Omegatron 17:13, Feb 24, 2004 (UTC)

On Heisenberg - perhaps not just one mathematical formulation that says it. There is a version that says 'you can't localise a function and its Fourier transform in a way that is better than with Gaussians'. The reason that all these versions are really the same, in essence, is hidden in some group representation theory (as I'd explain it). But I think it's fine to allude to this question in passing - the reasons no one can get round the issue are surely the same in both cases.

Charles Matthews 17:46, 26 Feb 2004 (UTC)

Basically, the Heisenberg incertainty principle lies in the fact that the wider your window is, the more precise your frequency measure will be, but at the same time the less precise your time measure will be. Take as an example a 440 Hz wave sampled at 44KHz. What is the measurable frequency of, say, 1 sample? You know from the definition that it will be 440 Hz, but the measure won't tell it to you. Same for 2 or slightly more consecutive samples. So when your measure time is very precise, the measure of the frequency is at best very unprecise. Now if you measure over more of a hundred samples, you will get the frequency, but you time measure will be far less precise. That basically means that a very precise time, there is no real frequency. For a comparison with quantum mechanics, I am not a quantum physicist, but I think that quantum variables are modelized using waves, and are entangled within them. For example, position and speed of a particle are modelized using frequency and X-axis. That means that the more precise you measure one of them, the more you lose precision on the other one. Again, I have no deep knowledge in the field, but that's what I have understood. Fafner 14:05, 7 November 2006 (UTC)

I'm aware that they're analogous, but are they really the same principle, or just similar in concept? — Omegatron 14:49, 7 November 2006 (UTC)
In quantum mechanics the fourier transform is often used to convert between a position-based representation and a momentum-based one. This trick can be used to derive the momentum-position uncertainty principle from the property of the STFT. Also, the standard treatment of the uncertainty principle really is a derivation of this property of the STFT from the Cauchy-Schwartz inequality. Because of this, I think they are essentially the same principle 69.234.75.107 20:58, 29 December 2006 (UTC)
The resolution of a time-frequency representation is constrained by Heisenberg's uncertainty principle. The wavelet transform allows different properties to be traded and, consequently, choosing to use low-uncertainty wavelets is of fundamental importance. See [http:// www.ffconsultancy.com/free/thesis.pdf my PhD thesis] and references therein for details. Jon Harrop 11:46, 16 April 2007 (UTC)

## Wavelet transform?

Is it true that the STFT is a special case of a wavelet transform? -- GWO 13:59, 26 Feb 2004 (UTC)

I'm not certain, but I really don't think so. Rather, I think they are both special cases of the time-frequency-scale transform. This is like a bunch of STFTs stacked up on top of each other like sheets of paper to make a volume, and each STFT has a different windowlength, increasing in one direction. An STFT of a certain windowlength is a slice in one dimension, and a wavelet transform is a slice in a perpendicular dimension. But I really don't know much about that. Just skimmed through some articles a while ago.  :-) Omegatron 15:00, Feb 26, 2004 (UTC)
I know that this is a really old comment, but I had to comment to correct. The advantages of the DWT (discrete wavelet transform)is that it doesn't "slice" the time frequency domain.
A single application of the DWT will give coefficients for very localized in time (but not in frequency) high frequency "events" and very localized in frequency (but not in time) low frequency "events". I'm only calling them events because I don't know what else to call them. You're basically dividing the time-frequency domain into layers of different shaped (but equal in area) blocks.
This is only what I've read so don't take my word as if I'm an expert in this area. Root4(one) 15:59, 27 March 2007 (UTC)

## Omega vs W

Hello,

Wikipedia is rendering ω ${\displaystyle (\omega )}$ and w ${\displaystyle (w)}$ the same way. The equation got really confusing. It would be nice if the writer changed, at least temporarily, say, the w to W. Also, admins should try to fix the bug. --Hdante 23:13, 9 February 2006 (UTC)

In the TeX equations or in the HTML? If ω and w look the same to you, that's a browser issue. It might be helpful to:
• Use a letter other than w for the windowing function — Omegatron 02:53, 10 February 2006 (UTC)
No, I meant in TeX. I can see ω and w here. Anyway, I could see that they are different in the TeX rendering. However, they are too much similar, only differing by a small curved stroke in the left side and small thickness differences. I still think it should be changed. --Hdante 19:36, 10 February 2006 (UTC)

## notation

When referring to the imaginary unit, can we please change the j to an i? Only electrical engineers use j, and the justification there (beyond "tradition!") is silly, since current (I) is talked about much more than current density (i). --Aaron Denney 22:49, 5 March 2007 (UTC)

## resolution

the wikilink to resolution to point to a more exact page. Resolution (logic) makes sense to me but I could be wrong. STHayden [ Talk ] 02:30, 22 August 2006 (UTC)

## Missing "Archived" Peer Review

What happened to it!? Root4(one) 16:08, 27 March 2007 (UTC)

It was requested, but it never had one. — Omegatron 17:41, 27 March 2007 (UTC)

## Reassignment method

There was a lot of information about the reassignment method on this page. I've moved it onto its own page because it does not belong here (it is equally applicable to other linear TFRs, e.g. CWT). Jon Harrop 12:04, 16 April 2007 (UTC)

## Compactly Supported

The term "compactly supported" has nothing to do with how narrow a window is. Any finite width window is compactly supported. compact is a technical term from topology, not a description of size. I'm not updating the main text because signal processing isn't my field, but I know enough to spot this error. —Preceding unsigned comment added by Sigfpe (talkcontribs) 01:12, 20 March 2009 (UTC)

## Overlap

The overlap and what it does to the time-resolution vs. frequency resolution issue could maybe be explained more?

As I understand it, overlapping windows in a sense increase the sampling rate and in this way does nice things for both frequency and time-domain - but this sounds a bit too good to be true? —Preceding unsigned comment added by Klokbaske (talkcontribs) 13:30, 7 January 2010 (UTC)

## Example

I don't think the example is very helpful because the time resolution with the longest window actually detects the transitions just as well as the shorter windows because the windowing aligns perfectly with the transitions in the input signal. To get a feel for the time vs. frequency tradeoffs you need to have a signal which changes over time or a signal with some transients in it. —Preceding unsigned comment added by 129.101.156.108 (talk) 19:29, 24 March 2011 (UTC)

## A more general overview of STFT mentioning FFT/DFT

Might it be worth mentioning more explicitly the use of DFT (or FFT for more practical purposes) when calculating the STFT?

A quote from this site sums it up very nicely. Something like this paraphrased into the article would make it much clearer for people who want more of an overview of STFT and its purpose, rather than a only a mathematical breakdown:

In the analysis of signals, the FFT is a commonly used tool for frequency

estimation and detection. One of the shortcomings of a simple FFT approach when analyzing data is that if an FFT is taken over a long period of time, the frequency resolution will be quite good, but no time information is given by the result. If one is analyzing non-stationary signals, it is often desirable to understand what frequencies were present in the signal and when were they present. One tool used in such analysis is the Short Time Fourier Transform (or STFT). This STFT consists of taking multiple FFTs on a set of data, with each one operating on a different time slice of the input data. The result is a matrix of many FFTs, each representing the frequency content during a particular window in time (where the window is determined by the FFT length chosen). The resultant matrix of FFTs can be easily analyzed to determine where and when strong signals occur.

Also a partial list of some of the applications as mentioned here would be appropriate. — Preceding unsigned comment added by Skytopia (talkcontribs)

Actually, that doc sounds rather nonsensical, mixing up the concept of FFT with how it might be applied; what is "a simple FFT approach"? Forget about FFT for now, and start with Fourier series and DFT, which apply to finite segments of continuous or discrete signals. These are the basis of STFT. In the discrete case, the FFT is just a fast algorithm for computing the DFT. Dicklyon (talk) 06:24, 24 June 2012 (UTC)
Yes, I presume they just said FFT because that is commonly used when calculating the STFT.

## Nonzero for only a short period of time

The article says "the function to be transformed is multiplied by a window function which is nonzero for only a short period of time" but then Gaussian bell is given as an example of a window function. A Gaussian bell is nonzero on the whole real line, so maybe the sentence should be rephrased to something like "the function to be transformed is multiplied by a window function which is zero (or very close to zero) except for only a short period of time"? Jaan Vajakas (talk) 15:47, 24 July 2013 (UTC)

I linked to Window function#Gaussian window, which has a comment about making the window finite. Glrx (talk) 20:39, 25 July 2013 (UTC)

## Inverse STFT

Shouldn't there be the window function w(x) involved in the inverse STFT reconstruction formula ? See for example for answer here : http://math.stackexchange.com/questions/568204/inverse-of-short-time-fourier-transform — Preceding unsigned comment added by 86.75.253.162 (talk) 14:21, 24 November 2013 (UTC)

## Too understandable

What's this, a Wikipedia math article written (and helpfully illustrated) in a way that students of science or engineering can understand and benefit from? Clearly, this needs to be marked with a "Rewrite Required" template, until it is brought in line with the usual level of post-graduate academic math elitism/obscurantism of the math-related segment of English Wikipedia!
Kidding aside, kudos to the authors of this article. — Preceding unsigned comment added by 85.180.76.23 (talk) 09:25, 7 March 2015 (UTC)

## Off-by-one error in Explanation paragraph

The article states, in the "explanation" paragraph:

   These N/2 coefficients represent the frequencies 0 to fs/2 (Nyquist) and two consecutive coefficients are spaced apart by fs/N Hz.


It seems to me there is an off-by-one problem in this statement:

- there are N/2 coefficient, let me number them 0 to N/2-1, and use the letter i for the coefficient index.

- there are N/2 coefficient, there are N/2 frequencies those coefficients correspond to. I'll note them f(i), where i goes from 0 to N/2 - 1.

- the first coefficient, where i = 0, represents the frequency 0 Hz: f(i=0) = 0 Hz

- the coefficients are spaced apart by fs/N Hz. so f(i=1) = f(i=0) + fs/N, ..., f(i+1) = f(i) + fs/N

- by induction: f(i) = i * fs/N

- the last possible value for i is N/2 - 1, so the last value for f(i) is f(N/2 - 1) = (N/2 - 1) * fs/N = fs/2 - fs/N

so the N/2 coefficients CANNOT represent the frequencies 0 to fs/2, but only 0 to fs/2 - fs/N

OR

they may also represent the frequencies fs/N to fs/2

OR

they may also represent the frequencies 0 to fs/2, but then two consecutive coefficients are spaced apart by (fs/2) / (N/2 - 1) Hz, not (fs/2) / (N/2) Hz.

OR there are actually one more coefficient in the output, to reach N/2 + 1

I am not competent enough to understand which of these cases is correct.

Thanks Jdmuys (talk) 12:41, 16 March 2016 (UTC)