I have a series of 192 data in a 3.14(m) domain. I use the "fft" command to plot the energy spectrum. How can I calculate wavenumber(k) of each grid?
Code:
data= load('data.txt');
PHI = fft(data);
% K=?? ;
%loglog(K,abs(PHI));
I have a series of 192 data in a 3.14(m) domain. I use the "fft" command to plot the energy spectrum. How can I calculate wavenumber(k) of each grid?
Code:
data= load('data.txt');
PHI = fft(data);
% K=?? ;
%loglog(K,abs(PHI));
The wavenumbers are uniformly spaced spatial frequencies, obtained in a similar fashion as the FFT bin frequencies for temporal signals. You can thus compute them using the following:
K = [0:(len(data)-1)]/len(data) * (192/3.14);
Note that this give meaningful wavenumbers up to the Nyquist limit of len(data)/2 - 1
. Above that you may prefer to use negative wavenumbers :
N = len(data);
K = [[0:(floor(N/2)-1)] ; [floor(N/2):(N-1)]-N]/N * (192/3.14);