# How to define the spatial frequency in Matlab?

Hello all,

I am working on the simulation of 1-D nonlinear elastic waves using Iteration contrast source technique. In which, I have some questions on a correct definition for spatial frequency and wavenumber. The spatial differential operator in the nonlinear force term (dx^2 and dx) will become (-k^2 and -j*k) in the frequency domain (j-imaginary number). I understand that wrong definition of k vector has a huge impact on the results because of the multiplication of square terms (-k^2) to u (displacement). I have shown my code which has different definitions of k (where M-spatial sample points). Also, whether the spatial frequency of a longitudinal wave (k_x) and shear wave (k_y and k_z) are same or different? Please share your knowledge. Many thanks in advance.

%% Spatial frequency
% dk=1/(dx); % Wavenumber increment
% kp=([(0:M/2-1) (-M/2:-1)]./M) * (dk); % == k_x %with/without 2*pi
% ks=([(0:M/2-1) (-M/2:-1)]./M) * (dk); % == k_x
% kp=(0:M-1)*(dk);
% ks=(0:M-1)*(dk); 