1
$\begingroup$

I have been studying about the box window and am unable to understand one thing, do we first sample a signal and then window it resulting in up-scaling or downscaling, or is windowing a practical case of sampling itself which is performed on a continuous time signal?

$\endgroup$
2
  • $\begingroup$ Box window=rectangular window? $\endgroup$
    – Adiel
    Commented Nov 4, 2014 at 13:20
  • $\begingroup$ yes, the rectangular window... $\endgroup$
    – Ghosal_C
    Commented Nov 4, 2014 at 21:50

2 Answers 2

4
$\begingroup$

Alright, the way to think about the rectangular window (as well as all of the other windows) is that you begin with an infinite sequence of samples and you multiply the samples outside the window with 0 and the samples within the window with something non-zero (and usually, but not always, positive).

So the DFT (of which the FFT is fast method of doing the DFT) does periodically extend the $N$ samples passed to it. But there are a couple of different ways of looking at it. One way to look at it is with just the definitions of the DFT and iDFT:

$$ X[k] = \sum\limits_{n=0}^{N-1} x[n] \ e^{-j 2 \pi nk/N} $$

$$ x[n] = \frac{1}{N}\sum\limits_{k=0}^{N-1} X[k] \ e^{j 2 \pi nk/N} $$

The $x[n]$ that the DFT $X[k]$ is aware of is simply a periodic sequence with period of $N$. both $$ x[n+N]=x[n] $$ and $$ X[k+N]=X[k] $$ are true.

Now the alternative way to think about the DFT is that it is the sampling of the spectrum of the Discrete-Time Fourier Transform (DTFT):

$$ \hat{X}\left( e^{j \omega} \right) = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] \ e^{-j \omega n} $$

where $ \hat{x}[n] = \begin{cases} 0, & n < 0 \\ x[n], & \text{for }0 \le n < N \\ 0, & N \le n \end{cases} $

and this is the same as multiplying by a rectangular window.

$$ \hat{x}[n] \ = \ x[n] \ w[n] $$

where $ w[n] = \begin{cases} 0, & n < 0 \\ 1, & \text{for }0 \le n < N \quad \quad \\ 0, & N \le n \end{cases} $ (length-$N$ rectangular window)

But here you cannot tell that you extracted $\hat{x}[n]$ from a periodic $x[n]$ or if those $N$ samples came from an infinitely long and non-repeating stream of samples. Whatever it is, $\hat{x}[n]$ is non-repeating, infinite in length (with all those zeros padded), and you can apply the DTFT to it.

It doesn't have to be the rectangular window, it could be any length-$N$, finite-valued window for $w[n]$ and the math that follows is the same.

Now with that definition of $\hat{x}[n]$ and $\hat{X}\left( e^{j \omega} \right)$, it's not hard to show that

$$ \hat{X}\left( e^{j \omega} \right) \Bigg|_{\omega = 2 \pi \frac{k}{N}} = \hat{X}\left( e^{j 2 \pi k/N} \right) = X[k] $$

Now, what happens in either domain, is that when you uniformly sample the function (say, in this case, the spectrum $\hat{X}\left( e^{j \omega} \right)$) in one domain, it causes in the other domain, the signal ($\hat{x}[n]$) to be repeatedly shifted (by $N$ samples) and overlap-added:

$$ x[n] = \sum\limits_{m=-\infty}^{+\infty} \hat{x}[n+mN] $$

It is here where the discontinuity between $x[N-1]$ and $x[N]$ (which is the same as $x[0]$) becomes a concern, and tapered windowing to reduce or eliminate this discontinuity is perhaps indicated.

$\endgroup$
2
  • $\begingroup$ What are the basic three or four windows that i should familiarize myself with? $\endgroup$
    – Ghosal_C
    Commented Nov 6, 2014 at 9:29
  • $\begingroup$ i dunno. there are so many. rectangular, Hann, Hamming, Kaiser, Gaussian. it all depends on what you want to do. looks like i forgot to make an important point, so i will now edit the answer to make it. $\endgroup$ Commented Nov 6, 2014 at 12:32
1
$\begingroup$

Windowing is something you do after sampling, but before calculating the FFT.

When you sample a signal, you end up with a finite set of samples. Let's say you sample from $t=T_1$ to $t=T_2$. Usually, the signal around $T_1$ is very different from the signal around $T_2$. For example, the sample at $T_1$ could be large and positive, and the sample at $T_2$ could be large and negative.

However, the FFT assumes that the set of samples corresponds to exactly one period of a periodic signal. The period is $T_2-T_1$. The (possibly large) discontinuity between the sample at $T_1$ and the sample at $T_2$ introduces large frequency content that is not present in the original, continuous-time signal.

Windowing the signal reduces that discontinuity, by reducing the samples' amplitude at both ends. There are many kinds of windows, each with particular advantages and disadvantages.

$\endgroup$
5
  • $\begingroup$ This is true for windows like hamming, hann, blackman, etc. Why is it true for a rectangular window? why just cutting the signal cause a smaller difference between edges? $\endgroup$
    – Adiel
    Commented Nov 4, 2014 at 13:19
  • $\begingroup$ The rectangular window doesn't help at all. In fact, the rectangular window just multiplies every sample by 1. $\endgroup$
    – MBaz
    Commented Nov 4, 2014 at 14:04
  • $\begingroup$ From what I understand, the box car window doesn't help at all, infact it's not even windowing, it's just the sampling from T1 to T2 and then leaving the rest of the analog signal as zero. Windowing on the other hand is a DSP mechanism used to reduce the high frequencies which occur at the edges of the window due to sharp contrast between the signals at that point. Do I understand correctly? $\endgroup$
    – Ghosal_C
    Commented Nov 4, 2014 at 22:07
  • 1
    $\begingroup$ @ubuntu_noob, yes, you do. I would only add that there are many different windows, and each has slightly different properties. It'd be a good idea to familiarize yourself with at least the most common ones. $\endgroup$
    – MBaz
    Commented Nov 4, 2014 at 23:18
  • $\begingroup$ Right, window that attanuate the edges (all the commons as @MBaz mentioned) reduce the high frequencies. Rectangular window just separate your (discrete) signal to some parts. $\endgroup$
    – Adiel
    Commented Nov 5, 2014 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.