User:Dwight Landen/sandbox

bla bla what does this look like? = Time-frequency Analysis with the short-time Fourier transform = = Spectral moments =

Resolution issues
One of the perceived downfalls of the STFT is related or analogous to Heisenberg uncertainty principle, but it is not a direct relationship – see Gabor limit for discussion. The width of the windowing function relates to how the signal is represented; it determines spread or support of the function in the frequency domain. A wide time window results in a narrow frequency range. A narrower time window results in a wide frequency range. These are called narrowband and wideband transforms, respectively. In a more rigorous manner the duration $$\sigma_t$$ and bandwidth $$\sigma_\omega$$ can be defined
 * $$ {\sigma_t}^2 = \int{(t-\bar{t})^2|x(t)|^2 dt} $$
 * $$ {\sigma_\omega}^2 = \int{(\omega-\bar{\omega})^2|X(\omega)|^2 d\omega} $$.

Where the bar denotes the mean. It can then be shown that the uncertainty product is
 * $$ \sigma_t \sigma_\omega \leq \frac{1}{2} \sqrt{1+\operatorname{cov}(t,\omega)} $$

An additional complication arises when considering the discrete STFT. Discrete signals must consider not only the length of the time window but the sample rate. Sample rate will determine the maximum frequency that can be represented without aliasing or Nyquist frequency. Together, a STFT with no overlap and window length $$T$$ will have an uncertainty product of


 * $$\Delta\omega T=2 \pi $$

For a fixed time window, this means that a high sample rate with good time resolution will have a high Nyquist frequency and therefore the points will be spread over a wide range and thus frequency resolution will be poor. A low sample rate will have lower time resolution with a low Nyquist frequency with point spread over a narrow range thus better frequency resolution.



The choice of window functions are many, each with there own purpose. The boundary of the uncertainty principle is reached with a Gaussian window function, as the Gaussian minimizes the Fourier uncertainty principle. This is called the Gabor transform (and with modifications for multiresolution becomes the Morlet wavelet transform). One can consider the STFT for varying window size as a two-dimensional domain (time and frequency), as illustrated in the example below, which can be calculated by varying the window size. However, this is no longer a strictly time–frequency representation – the kernel is not constant over the entire signal.

Example
Using the following sample signal $$x(t)$$ that is composed of a set of four sinusoidal waveforms joined together in sequence. Each waveform is only composed of one of four frequencies (10, 25, 50, 100 Hz). The definition of $$x(t)$$ is:


 * $$x(t)=\begin{cases}

\cos (2 \pi 10 t/\mathrm{s}) & 0\,\mathrm{s}  \le t < 5  \,\mathrm{s} \\ \cos (2 \pi 25 t/\mathrm{s}) & 5\,\mathrm{s}  \le t < 10\,\mathrm{s} \\ \cos (2 \pi 50 t/\mathrm{s}) & 10\,\mathrm{s} \le t < 15\,\mathrm{s} \\ \cos (2 \pi 100 t/\mathrm{s}) & 15\,\mathrm{s} \le t < 20\,\mathrm{s} \\ \end{cases}$$

Then it is sampled at 400 Hz. The following spectrograms were produced:

The 25 ms window allows us to identify a precise time at which the signals change but the precise frequencies are difficult to identify. At the other end of the scale, the 1000 ms window allows the frequencies to be precisely seen but the time between frequency changes is blurred.

This is one of the reasons for the creation of the wavelet transform and multiresolution analysis, which can give good time resolution for high-frequency events, and good frequency resolution for low-frequency events, which is the type of analysis well suited for many real signals.

= Local Mean Frequency =

It is often then mistaken that the ability to determine the instantaneous frequency in limited by the uncertainty principle. The instantaneous frequency or "local mean frequency" can be very accurately determined and is limited more by the continuity of the instantaneous phase. To understand this the spectral density of the analytic signal must be considered
 * $$x(t) = A(t)e^{i\phi(t)} $$

and
 * $$S_{xx}(\omega)=X(\omega)X^*(\omega)$$.

The nth moment (mathematics) of the spectrum is given by
 * $$\langle{\omega^n}\rangle=\int{\omega^n S_{xx}(\omega)}d\omega$$

Which can also be expressed in the time domain as
 * $$\langle{\omega^n}\rangle=\int{x^*(t) ( {\frac{1}{i^n}\frac{d^n}{dt^n}} ) x(t)}dt$$

The first moment or "local mean" is
 * $$\mu_{\omega} = \frac{\langle{\omega}\rangle}{|S_{xx}|} $$

where
 * $$\langle{\omega}\rangle=\int{A^2(t)\dot{\phi}(t)}dt$$.

and
 * $$|S_{xx}| = \int{A^2(t)}dt $$.

Substituting the Gaussian window for $$ A(t) $$ and using the Taylor expansion of $$\phi(t)$$ at the midpoint of the sliding window $$\bar{t}$$, the expansion is
 * $$ \mu_\omega=\frac{1}{n!}\phi^{(n+1)}(\bar{t})M_n,n=0,1,2,...\infty$$

where $$ M_n $$ are the moments of $$ A(t) $$ with the expansion
 * $$ M_n = \frac{\sigma^{2k}(2k)!}{2^{2k}k!},n=2k$$.

where $$\sigma$$ is the standard deviation of the Gaussian window. The resulting expansion of the local mean is
 * $$ \mu_\omega=\dot{\phi}(\bar{t})+\frac{\sigma^2}{2}{\phi}^{(3)}(\bar{t})+\frac{\sigma^4}{32}{\phi}^{(5)}(\bar{t})+\frac{\sigma^6}{384}{\phi}^{(7)}(\bar{t})+...$$

= Bandwidth = = Optimal Windows = = Continuity and Accuracy Errors =