How to calculate wavenumber, for fft2 of a 2D array?
Ältere Kommentare anzeigen
I have perfomed fft2 on an image/2D-array (361x211). When I plot the result, using imagesc, I would like to label the axes with wavenumbers. However, for the fft2 output, I do not know how to calculate the wavenumbers (I commented out my this part of my code). Is it related to the image resolution (dpi)?
My code and output plots (amplitude and phase) are attached below. Thanks!
data = load ('86tr.txt'); % load xyz file
x = data(:,1); % longitude
y = data(:,2); % latitude
z = data(:,3); % anomaly (nano Tesla)
% Find the size (row,col) of the xyz file
row = length(unique(x));
col = length(unique(y));
% Reshape and transpose z values to get correct data orientaion
zm = reshape(z,row,col);
zm = fliplr(zm);
zm = zm';
% Perform fft2 on z-values (nT)
fft2_zm = fftshift(log(abs(fft2(zm)))); % amplitude
% phase_zm = angle(fftshift(fft2(zm))); % phase
% % Calculate wavenumbers
% Nc = col; Nr = row;
% dp = 1/300; % dpi = 300?
% kx = (-Nr/2:Nr/2-1)/(Nr*dp);
% ky = (-Nc/2:Nc/2-1)/(Nc*dp);
figure(1);
imagesc(fft2_zm); colorbar;

6 Kommentare
Star Strider
am 27 Mai 2023
The wavenumber values would be along the z axis and would be in terms of the (probably spatial) frequency (although there are no units listed for z in the file). You would need to calculate and show them as different colours, likely using the colorbar function. The other option would be to use surf, and then display them on the z-axis, likely also using colorbar as well, for clarity.
% T1 = readtable('86tr.txt')
.
Star Strider
am 27 Mai 2023
I looked at the original data by ‘slicing’ it horizontally at various levels. There are patterns that show up in the east-west direction, however nothing in the north-south direction. I would simply go with spatial frequency rather than wavenumbers.
Jay Ghosh
am 28 Mai 2023
Star Strider
am 28 Mai 2023
The spatial frequency would be in terms of
. I am not certain that it would be possible to expres anything about your data in terms of wavenumber.
. I am not certain that it would be possible to expres anything about your data in terms of wavenumber. I deleted my Answer because it became obvious to me that it was not going to provide the result you want, essentially because I am not certain that is possible.
Jay Ghosh
am 30 Mai 2023
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Fourier Analysis and Filtering finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



