calc_SMD_interface.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. %{
  2. Copyright © 2020 Alexey A. Shcherbakov. All rights reserved.
  3. This file is part of GratingFMM.
  4. GratingFMM is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  8. GratingFMM is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GratingFMM. If not, see <https://www.gnu.org/licenses/>.
  14. %}
  15. %% description:
  16. % calculate a diagonal S-matrix of an interface between two homogeneous
  17. % isotropic media for a fixed polarization and a 1D set of wavevector
  18. % projections
  19. %% input:
  20. % no: number of Fourier harmonics
  21. % kx0: zero harmonic wavevector projection
  22. % kg: wavevector step
  23. % eps1, eps2: permittivities of media below and above the interface
  24. % pol: polarization, either 'TE' or 'TM'
  25. %% output:
  26. % SMD: diagonal interface S-matrix of size (no,2,2)
  27. % block SMD(:,1,1) corresponds to refelection from below to below
  28. % block SMD(:,2,2) corresponds to refelection from above to above
  29. % block SMD(:,2,1) corresponds to transmission from below to above
  30. % block SMD(:,1,2) corresponds to transmission from above to below
  31. % central harmonic index is ind_0 = ceil(no/2)
  32. %% implementation:
  33. function [SMD] = calc_SMD_interface(no, kx0, kg, eps1, eps2, pol)
  34. [kz1, kz2] = fmm_kxz(no, kx0, 0, kg, eps1, eps2);
  35. SMD = zeros(no,2,2);
  36. if strcmp(pol,'TE')
  37. SMD(:,1,1) = (kz1-kz2)./(kz1+kz2);
  38. SMD(:,2,1) = 1 + SMD(:,1,1);
  39. SMD(:,2,2) = -SMD(:,1,1);
  40. SMD(:,1,2) = 1 + SMD(:,2,2);
  41. elseif strcmp(pol,'TM')
  42. SMD(:,1,1) = (eps2*kz1-eps1*kz2)./(eps2*kz1+eps1*kz2);
  43. SMD(:,2,1) = 1 + SMD(:,1,1);
  44. SMD(:,2,2) = -SMD(:,1,1);
  45. SMD(:,1,2) = 1 + SMD(:,2,2);
  46. else
  47. error('function calc_SM_interface: unknown polarization');
  48. end
  49. end
  50. %
  51. % end of calc_SMD_interface
  52. %