Transfer and Scattering Matrix Methods for Plane-Wave Propagation in Multilayer Structures (MATLAB)
Optics

This note documents my implementation of the transfer matrix method (TMM) and the scattering matrix method (SMM) for plane-wave propagation and scattering in one-dimensional multilayer structures. The focus is on a consistent field-amplitude definition and on numerical robustness when dealing with thick layers, evanescent waves, or large refractive-index contrasts. All MATLAB codes discussed here are available in my GitHub repository.
The physical problem considered throughout this note is the propagation of a monochromatic plane wave in a stratified medium, where each layer is homogeneous and isotropic, and interfaces are planar and parallel. Both TE and TM polarizations are supported. The formulation closely follows standard electromagnetic boundary conditions but is written in a way that is convenient for numerical implementation and for reconstructing the field everywhere inside the structure.
Field representation in multilayer structures
In each layer, the electric field is written as a superposition of forward- and backward-propagating plane waves along the
where
Transfer matrix formulation
The transfer matrix method relates the field amplitudes on the left side of the structure to those on the right side through a product of interface and propagation matrices. At each interface, the continuity conditions of the tangential electric and magnetic fields can be written in matrix form as
where
By cascading all interfaces and propagation matrices, one obtains the global transfer matrix
which directly relates the fields in the input and output semi-infinite regions. With the usual boundary conditions $A1=1
While the transfer matrix method is conceptually simple, it is well known that it may suffer from numerical instabilities when exponentially growing and decaying factors coexist. This motivates the use of the scattering matrix method.
Scattering matrix formulation
The scattering matrix method reformulates the problem in terms of incoming and outgoing waves at each side of a layer or a composite structure. For a generic subsystem, the scattering relation is written as
where
For a single homogeneous layer of thickness $dm
When multiple layers are present, the total scattering matrix is obtained by cascading individual scattering matrices. Given two subsystems with scattering matrices
By recursively applying this formula, one can build the global scattering matrix of an arbitrary multilayer stack in a numerically stable way.
Field reconstruction from the scattering matrix
Once the total scattering matrix is known, the incoming and outgoing wave amplitudes at the outer boundaries are directly related. For left incidence, one sets
Implementation and examples
The MATLAB functions provided in the GitHub repository implement both TMM and SMM using a unified field-amplitude convention. The function CoeAB_layer_TMM computes the layer-resolved coefficients using the transfer matrix method, while the scattering-matrix-based implementation (CoeAB_layer_SMM)provides improved numerical stability for thick or resonant structures. Additional routines allow direct reconstruction of spatial field profiles.
Several benchmark examples are included, such as Bragg mirrors and standing-wave formation in photoresist layers, where the numerical results agree well with RCWA calculations and classic analytical results reported in the literature.

Closing remarks
This note serves both as a theoretical reference and as a practical guide to the accompanying MATLAB code. By presenting the transfer matrix and scattering matrix methods within a consistent framework, it becomes straightforward to switch between the two approaches depending on the numerical requirements of the problem. Readers interested in the implementation details or in extending the code are encouraged to consult the GitHub repository linked in the blog.





