I am trying to obtain the discrete fourier transform of a function in an unit square, but the results i obtain with dfft package are different with the ones that I obtain using a Vandermode matrix. I provide a minimal code

Can anyone provide me a way to compute the fourier transform with dfft so I obtain the good results?
Please, let me know if I’m doing something the wrong way.

This looks like it is just an issue of coordinate offsets. See the attached
with an impulse spectrum areound (0,0). Your method interprets
this as high frequency whiile FFT apparently thinks it is DC. Your specturm
despite apparently being singular doesn’t vary that fast and looks like
DC in spectral domain AFAICT. Iguess I would play with the simple spectra
and see if this makes sense.

However, that doesn’t respond my question of how making dfft command to work as I expect. Using Vandermonde matrix is a bit slower and I intend to move to 3D in a while so performing the fourier transform with dfft correctly will save a lot of time and memory.

I’m not sure offhand how to do that but you would have to dig into the ff or ffttw docs
to see but if you really want to its just a coordinate transform. If you look at your
matrix, the DC component appears to xform to the origin while the fftw puts
it in the center giving you negative instead of aliased frequencies which is often
more convienient. I guess you could come up with a transformation matrix or a simple
loop to move th e quadrants around although it may also be worth trying to determin
if you want negative instead of aliased frequencies.