1
0

fmm_calc_T.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. % T-matrix of an interface between a photonic crystal and a homogeneous medium
  17. % the case of the collinear diffraction on 1D gratings
  18. %% input:
  19. % no: number of Fourier harmonics
  20. % EV: matrix of the electric field eigenvectors for the photonic crystal
  21. % HV: matrix of the magnetic field eigenvectors for the photonic crystal
  22. % kz: row of plane wave propagation constants in the homogeneous medium
  23. % eps: permittivity the homogeneous medium
  24. % pol: polarization
  25. %% output:
  26. % T: T-matrix of size 4*no by 4*no
  27. %% implementation:
  28. function [T] = fmm_calc_T(no, EV, HV, kz, eps, pol)
  29. T = zeros(2*no,2*no);
  30. ib1 = [1:no];
  31. ib2 = [no+1:2*no];
  32. if strcmp(pol,'TE')
  33. ikz = transpose(0.5./kz);
  34. T(ib1,ib1) = HV.*ikz;
  35. T(ib2,ib1) = 0.5*EV - T(ib1,ib1);
  36. T(ib1,ib1) = T(ib1,ib1) + 0.5*EV;
  37. T(ib1,ib2) = T(ib2,ib1);
  38. T(ib2,ib2) = T(ib1,ib1);
  39. elseif strcmp(pol,'TM')
  40. eikz = transpose((0.5*eps)./kz);
  41. T(ib1,ib1) = EV.*eikz;
  42. T(ib2,ib1) = 0.5*HV - T(ib1,ib1);
  43. T(ib1,ib1) = T(ib1,ib1) + 0.5*HV;
  44. T(ib1,ib2) = -T(ib2,ib1);
  45. T(ib2,ib2) = -T(ib1,ib1);
  46. end
  47. end