This is an animation of a resonant cavity with PEC walls with a copper resonator (cube) on the bottom at the center.  The plot shows the x-component of the E field, but it is over a slice of the y-z plane so the x fields are zero at the boundaries and the cube appears at the back of the structure.

These are Finite-Difference Time-Domain (FDTD) simulations I created in MATLAB.  The modeled structure is a rectangular  resonating cavity with perfectly conducting (PEC) walls.  Gaussian electric field pulses are defined at variable points in the cavity and propagate as electromagnetic waves.  

​The simulations are presented here as animations of the z-component of the electric field on a slice of the x-y plane.  For large time values the animation can be suppressed and the resulting plots shown as slices along one dimension on which an FFT is performed.

This is an animation of a resonant cavity with PEC walls half filled with lossy dielectric.  The cavity is filled at the bottom, halfway up the z-axis.  The plot shows the x-component of the E field, but it is over a slice of the y-z plane so the x fields are zero at the boundaries.

This is an animation of a resonant cavity with PEC walls with a single-slit diffraction apparatus.  The plot shows the z-component of the E field, and it is over a slice of the x-y plane.  The narrow pulse can get through both narrow and wide apertures but only the narrow pulse penetrates the narrow aperture significantly.  The PolyBox function is required to draw the apertures.  They are only for graphical purposes, the actual slit device is coded in the FDTD algorithm and works the same whether you include the image of them or not. 

Finite Difference Time Domain Simulations