In this MATLAB script, the transfer matrix method was used, where transmission and reflection were calculated for each interface in the stack as well as attenuation in each layer. The wavelength-dependent optical constants (n and k) of each layer were measured by spectroscopic ellipsometry (SE). | Optical simulation of planar CH3NH3PbI3 perovskite solar cells