Examples - Disk


Download this example:

Using the colormap plot style with the fft command to draw a diffraction pattern (I)

The Fourier transform of a disk, plotted using the colormap plot style.


# Definition of function representing a disk
disk(x,y) = tophat(hypot(x,y) , 1)

# Take FFT of disk
fft [-40:40:0.1][-40:40:0.1] fft() of disk()

w = unit(5*cm)
set numerics complex
set nogrid
set key below
set nocolorkey
set sample grid 300x300
set size w square

set multiplot
set nodisplay

# Plot real-space image
plot [-2:2][-2:2] disk(x,y) with colormap

# Plot Fourier-domain image
set origin w+unit(5*mm),0
set axis y right
plot [-2:2][-2:2] abs(fft(x,y)) with colormap

set display