% generate the wavenumbers
k=-nx/2:nx/2-1;
% take the Fourier transform then shift wavenumbers
cy=fftshift(fft(y));
