For consistency with the supplied wavenumbers, use an FFT grid on a periodic interval: , , and similarly for . In MATLAB, replace the endpoint-inclusive coordinate definitions by x = (0:nx-1)*Lx/nx; and y = (0:ny-1)*Ly/ny;. The supplied linspace arrays instead have spacing while the Fourier multipliers assume . Including both copies of the periodic endpoint creates a grid inconsistency, separate from high-frequency aliasing.