It steps you through TMM and provides some good references. There are recorded lectures, notes, and other resources to help you write your own TMM code. For example, there is a "Benchmarking Aid for TMM" that shows you almost all of the intermediate results for a TMM code. From this you can see the order that things are calculated and you can use it to check your code line-by-line.
It steps you through TMM and provides some good references. There are recorded lectures on YouTube, electronic notes, and other resources to help you write your own TMM code. For example, there is a "Benchmarking Aid for TMM" that shows you almost all of the intermediate results for a TMM code. From this you can see the order that things are calculated and you can use it to check your code line-by-line.
Another thing that may be of interest to you is the finite-difference time-domain (FDTD) method. TMM is certainly more efficient for 1D structures, but FDTD is a great learning tool because you can visualize and watch the fields interact with your grating. Also, I provide a series of six "MATLAB Sessions" where I step you through writing a very powerful 1D-FDTD algorithm in MATLAB. You can find this here: