# How to obtain the exact value of wavelength from a 2D FFT amplitude vs wavenumber plot like it is obtainable from 1D FFT amplitude vs wavenumber plot?

I have a two dimensional multi modal spatial signal generated from a MATLAB code using sinusoidal functions of different wave numbers, amplitudes and phases. What I want to know is that if I have the amplitude vs wave number plot of that signal, how can I extract the wavelength of the different spatial structures. For 1D signal and 1D FFT I know that it is possible to extract the wavelength from the amplitude vs wavenumber plot by simply taking the reciprocals of the wave numbers with non zero amplitudes. But how can it be done for 2D signal and 2D FFT? I am attaching my code below.

Ws=160; % Sampling wavenumber @ 160 Hz

L=10; % Length of domain = 10cm

N = L*Ws; % Length of signal

x = (0:N-1)*(1/Ws); % Space vector

y = [(0:N-1)*(1/Ws)]'; % Space vector

x = repmat(x,1600,1); % Space matrix

y = repmat(y,1,1600); % Space matrix

V = sin((4pix)/L)+sin((4piy)/L); % Function in the spatial domain `

fx = linspace((-Ws/2),Ws/2,N); % computing wavenumber vector fx

fy = [linspace((-Ws/2),Ws/2,N)]'; % computing wavenumber vector fy

fx = repmat(fx,1600,1); % computing wavenumber matrix fx

fy = repmat(fy,1,1600); % computing wavenumber matrix fy

T = fft2(V); % 2D FFT

subplot(1,2,1)

pcolor(x,y,V) %%%% Contour plot in spatial domain

ax = gca;

ax.LineWidth = 2;

colormap jet

colorbar

pbaspect([1 1 1])

xlabel('X(cm)-->.')

ylabel('Y(cm)-->.')

title('V = sin((4pix)/L)+sin((4piy)/L)')

subplot(1,2,2)

pcolor(fx,fy,abs(fftshift(T))) % Contour plot of FFT amplitude vs wavenumber

lin = zeros(1,N);

hold on

plot(lin,fy(1:1600),'b') % Vertical line passing through (0,0) in fft amplitude plot

hold on

plot(fx(1:1,1:1600),lin,'k') % Horizontal line passing through (0,0) in fft amplitude plot

colormap jet

colorbar

pbaspect([1 1 1])

xlabel('Wx(cm^{-1})')

ylabel('Wy(cm^{-1})')

title('FFT amplitude')

I am attaching the plot which I got as well. Any help would be greatly appreciated.

First, you want to find the peaks in this 2D plot. In your case, you know that there will be 2 peaks in your FFT (because you added two sines). Your plot shows 4 peaks because the FFT magnitude is symmetric, since your signal is real. You can discard negative wave numbers and look for peaks among the positive wave numbers.

The wave numbers corresponding to those peaks belong to your signal. There will be two wave numbers corresponding to each peak, $$k_x$$ and $$k_y$$. We know that $$k = \frac{2\pi f}{c}$$, where $$k = \sqrt{k_x^2 + k_y^2}$$ is the wave-number, $$f$$ is the frequency in Hz and $$c$$ is the speed of sound in the medium. Now, using $$\lambda = \frac{c}{f}$$, we can deduce that $$\lambda = \frac{2 \pi}{k}$$.

• So I should pick any of the structures from the first quadrant. Another confusion I do have is at which position of the structure should i obtain the value of kx and ky, because the structure is not a pointed one? Do I need to calculate the centroid of a structure? May 8 '21 at 8:09
• There will be a single pointy peak for a sine function, just like in the ID FFT. The other colors around the peak go progressively from red to blue, the reddest dot in the center is your peak. You can start by finding all local peaks, and sort them in descending order. Then select the top 2 from the sorted peaks. A local peak is one whose magnitude is greater than its neighbors. if X(i,j) > X(i,j-1) && X(i,j) >X(i,j+1) && X(i,j) > X(i-1,j) && X(i,j) > X(i+1,j), then X(i,j) is a local maxima. May 8 '21 at 9:15
• Thanks for your answers. There is another confusion which I do have is that when I calculate the resultant wave numbers, the structure at the right is not giving same result as the structure on the left which it should give, same is the case with top and bottom structures. The resultant wave number of the left structure should match with the resultant wave number of the right structure and the resultant wave number of the top structure should match with the resultant wave number of the bottom structure. Can you suggest any reason for my case not being so? May 9 '21 at 15:55
• What are the wave numbers? I thought you were calculating them from the first quadrant only. Suppose your wave numbers are k_1. = (k_x,0) and k_2=(0, k_y). Then using the symmetry property, the other two should be at -k_1 and -k_2. So the first quadrant and third quadrant should be the same, and second and fourth should be the same. May 9 '21 at 17:46