By default, in the simulation, the beam is always defined at the center of the grid. After the definition of a beam, it is possible to shift it by simply offsetting the whole complex field. The offset will be an integer number of pixels to avoid any interpolation. Example:
G1 = Grid(512,0.16); E1 = E_Field(G1,'w0',0.01); E2 = E1; Offset_X = 0.01; Offset_Y = 0.03; E2.Field = circshift(E2.Field,[round(Offset_Y/G1.Step), round(Offset_X/G1.Step)]); figure(1); E_Plot(E1) figure(2); E_Plot(E2)
Be sure to have a large enough grid to not clip the Gaussian beam. The function circshift() will not clip the beam but rather shift the pixels to the other side of the grid. It is wise to always visually check the results by displaying the beam.