Intrinsically in FFT code, the Gouy phase is automatically calculated. For design purpose, we would like to calculate the accumulated Gouy phase as the beam propagates.

The function attached calculates the Gouy phase of a TEM00 beam for a propagation length defined by the user. The principle behind it is to calculate the phase of the field and subtract the phase of the corresponding plane wave.

The example script shows how to use the function. From the output of the function is possible to plot the evolution of the Gouy phase as shown in the following picture

The waist size and position can be calculated from the Gouy phase plot, which is suppose to be symmetric respect to it. In the example the expected waist size and position is calculated with Matlab interpolation function. The results is then compared to the values obtained from the OSCAR Fit_TEM00 function

Through the Fit_TEM00 function is also possible to see how the beam size change in the propagation

So far the function works well only for the TEM00 mode. However we plan to adjust it in order to make it work also for arbitrary beams (i.e. HOM).