I found that a discrete form of the Wigner distribution was $$WD(n,k) = \sum_{m = -N/2}^{N/2}f(n+m)f^*(n-m)e^{-j\frac{2\pi}{N+1}2mk}$$ where $f(n)$ is the signal and time limited within $|n|\le N/2$. I manage to find the matlab code of the Wigner distribution (Sorry that I am not very familiar with the format to put the codes):

 1. function [WD] = EVD_tfrwv(x0)
 2. X=fft(x);
 3. X=[X(1:N/2+1);zeros(N,1);X(N/2+2:N+1)];
 4. x=2*ifft(X);
 5. x=[zeros(N,1);x;zeros(N,1)];
 6. X=zeros(2*N+1);
 7. for k=1:2*N+1   X(:,k)=x(k+(0:2*N));  end 
 8. ww=X.*conj(flipud(X));
 9. WW=fft(ww([N+1:2*N+1,1:N],:)); 
 10. WW=real(WW([N+2:2*N+1,1:N+1],:));

My question is

  1. I understand line 8 tries to get the correlation $f(n+m)f^*(n-m)$ (probably) for different time $n$, but I get confused when line 9 performs the FFT after rearranging the order of these correlation samples. Could anyone tell me why we have to do this?
  2. Line 10 has similar operation.
  3. Why there is a real operator in line 10? I do not see any real operator in the Wigner distribution formula although I understand Wigner distribution is a real distribution.

Thanks for anybody who tries to help!

  1. The FFT comes from the summing operation and multiplication by the complex pointer term in the formula. Compare it to the formula for the DFT (or FFT):

    $$X_k = \sum_{n=0}^{N-1} x_n\cdot e^{-\frac {2\pi j}{N}kn}$$

  2. This is not similar, real just returns the real part of the array.
  3. The Wigner distribution is real, but because of rounding errors, there is always a very small complex part in the result. This operation removes it and just returns the real part.
  • $\begingroup$ But I still do not understand why it has to do the rearrangement in line 9 and 10. $\endgroup$
    – ZHUANG
    Mar 22 '18 at 7:54
  • $\begingroup$ @Brucezhuang, I highly recommend you to debug the code and see what happens line by line. Having an analytical result you can compare that against will make it even easier. This way you will learn and understand it better $\endgroup$ Mar 22 '18 at 8:43
  • $\begingroup$ I second that. Debugging is the best thing you can do to get an understanding of what is going on there. $\endgroup$
    – Max
    Mar 22 '18 at 9:13
  • $\begingroup$ I tried the debugging and I found that Line 9 actually made sense. Note that the summation starts at $-N/2$ which cannot be performed in computer. The complex exponential should be $$e^{j\frac{2\pi}{N+1}2mk + j\frac{2\pi}{N+1}2m(N+1)} = e^{j\frac{2\pi}{N+1}2m(k+N+1)}$$ for $k < 0$, which can be treated that the negative part is "moved" to the front. That explains the element rearrangement. But I am not sure about the rearrangement in Line 10. $\endgroup$
    – ZHUANG
    Mar 23 '18 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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