calc_emn_lam.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. % Fourier matrix of the permittivity and the inverse permittivity of a
  17. % 1D lamellar grating
  18. %% input:
  19. % no - number of Fourier harmonics
  20. % alp - lamellae width relative to the grating period (0 < alp < 1)
  21. % eps1 - lamellae permittvity
  22. % eps2 - surrounding medium permittvity
  23. %% output:
  24. % FE: Fourier matrix of size (2*no-1,2), which contains
  25. % Fourier components of the permittivity (FE(:,1)) and the inverse
  26. % permittivity (FE(:,2))
  27. %% implementation
  28. function [FE] = calc_emn_lam(no, alp, eps1, eps2)
  29. FE = zeros(2*no-1,2);
  30. te1 = eps1 - eps2;
  31. te2 = 1/eps1 - 1/eps2;
  32. % zero harmonic
  33. FE(no,1) = eps1*alp + eps2*(1-alp);
  34. FE(no,2) = alp/eps1 + (1-alp)/eps2;
  35. % non-zero harmonics:
  36. ind = linspace(1,no-1,no-1);
  37. ifun = transpose(sin(ind*pi*alp)./(ind*pi));
  38. FE(no+1:2*no-1,1) = te1*ifun;
  39. FE(no+1:2*no-1,2) = te2*ifun;
  40. FE(no-1:-1:1,1) = FE(no+1:2*no-1,1);
  41. FE(no-1:-1:1,2) = FE(no+1:2*no-1,2);
  42. end
  43. %
  44. % end of calc_emn_lam
  45. %