1
$\begingroup$

I am trying to find the PSD of a 2D set of data and representing it as a function of frequency in both these directions. I start with a 2D FFT and generate the 2D hanning window for a $M\times N$ sized dataset $X$ by

w_1 = hanning(M); 
w_2 = hanning(N);   
w = w_1*w_2';
y_m = fft2(X.*w);    

Now, I am having difficulty in applying the scaling to this 2-D PSD. For a 1-D dataset the scaling is given by:

\begin{align} S_1 &= \sum_{i=0}^{M-1}w_i\\ S_2 &= \sum_{j=0}^{N-1}w_j\\ \textrm{PS} &= \frac{2\lvert y_m\rvert^2}{S_{1}^{2}}\quad\text{for a 1D PSD} \end{align}

I am not sure how the scaling should be modified for a 2D PSD. Should it be $PS = \frac{2|y_m|^2}{S_{1}^{2}S_{2}^{2}}$?

$\endgroup$

1 Answer 1

0
$\begingroup$

There is a simple way to test whether your scaling is correct: the amplitude of the $0$ frequency y_m(0,0) should be proportional to the mean of the windowed data (the one you apply the FFT too). Something similar was discussed in What are the units of my data after an FFT?, and in DCT and mean difference of an image for the constant of proportionality, related to the number of samples, or its square root.

Hence, the amplitude of the PSD (at $0$-frequency) should be proportional to the square of the mean of the windowed data. This recipe should help you in general for normalizations with linear transformations: track the average and the $0$ or DC frequency and compensate for the scalar term (and the power).

However, I am troubled by your 1D normalization. Two procedures are detailed in Spectrum and spectral density estimation by the Discrete Fourier transform (DFT), including a comprehensive list of window functions and some new flat-top windows (Section 9: Scaling the results).

The first one, called 'power spectrum' (PS) is with your $S_1$. I am not too familiar with it [and welcoming comments by other folks on SE.DSP], so you could go for the square of the sum ($S$) of the 2D window coefficients:

$$S^2 = \left(\sum_{i=0}^m \sum_{j=0}^n w_i w_j\right)^2\,.$$

In my experience, in most of the cases in the frequency domain, one normalizes by the energy of the window (called $S_2$ and PSD in the above paper), or its square root. Here you normalize by the square of the sum of the window coefficients. Quite non-standard for a PSD to me! And this would not make sense with a $0$-mean window (like a Gaussian derivative). In that case, I would normalize by the energy of the product:

$$\mathcal{S} = \sum_{i=0}^m \sum_{j=0}^n \left(w_i w_j \right)^2\,.$$

So you proposal is unlikely: you can see an inhomogeneity in the units: square on top, fourth-power on bottom.

The most important question remains: why do you want to normalize (several possible answers)?

And a final comment: one should call it an Hann window (not Hanning), and I am not sure the tensor-product of two Hann windows does qualify for a "2D Hann" (circular versions probably more appropriate).

$\endgroup$
2
  • $\begingroup$ Due to the scaling factor, should a scaling be applied to the removal of the DC coefficient prior to the FFT? Also, instead of the mentioned "2D Hann" window, would it make more sense to perform the DC removal in 1 direction and calculate the FFT with a 1D Hann window, and then repeat the same process in the other direction? $\endgroup$
    – FL8
    Dec 13, 2016 at 4:32
  • $\begingroup$ Generally, the scaling applied to the DC and the "Nyquist" should have a different scaling (a factor of two) because their are not "duplicated" in the FFT. On your other question, it depends on the aim of your processing $\endgroup$ Dec 13, 2016 at 9:02

Your Answer

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

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