% Create an array that gives the correct k values for all FFT elements (in 1D).
function k = k_array(N, dx)
% N = number of elements in array.
% dx = sample interval in coordinate space.
% Units of k are radians per unit x (x can have any units).
k = [0:N/2, -ceil(N/2-1):-1] * (2*pi) / (N*dx);
