In Matlab/Octave/Scipy, what is the correct way of shifting the frequency components after performing 2D Fourier transforms back and forth between two planes (with the output plane being the far-field diffraction plane of the input plane) ?
Let's say that I would like to run an iterative Fourier-transform algorithm between these two planes in order to compute a hologram (the phase-delay pattern to be applied to the input plane), in order to obtain a given intensity pattern in the output plane.
Let the field in the input plane be called A and the field in the output plane called B.
So B will be the Fourier transform of A, and A the inverse Fourier transform of B (this follows from the Franhauffer diffraction theory).
The question is: in what order shall I shift the frequency components with the command fftshift in between the Fourier transforms connecting the two planes ?
It seems that writing the following does not do the job: B=fftshift(fft2(A)); A2=fftshift(ifft2(B));
This is probably a common issue but I couldn't find the answer anywhere..
fftshift
at all? – Oliver Charlesworth