1
0

calc_emntd_lam.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 permittivity Fourier matrix of a 2D lamellar grating
  17. % being periodic in x and y dimensions of the 3D Cartesian coordinates
  18. %% input:
  19. % xno, yno: numbers of Fourier harmonics
  20. % ax, ay: aspect ratios, should be between 0 and 1
  21. % eps1: pitch permittivity (occupies ax*ay volume fraction of the period)
  22. % eps2: permittivity of a medium which surrounds the pitch
  23. % (occupies (1-ax)*(1-ay) volume fraction of the period)
  24. %% output:
  25. % FE: cell array containing two Fourier matrices of the permittivity and
  26. % inverse permittivity
  27. %% implementation:
  28. function [FE] = calc_emntd_lam(xno, yno, ax, ay, eps1, eps2)
  29. FB = zeros(2*yno-1,2*xno-1);
  30. FE = cell(1,2);
  31. FE{1,1} = eps2 + FB;
  32. FE{1,2} = 1/eps2 + FB;
  33. ix = linspace(1,xno-1,xno-1);
  34. iy = linspace(1,yno-1,yno-1);
  35. [IX,IY] = meshgrid(ix,iy);
  36. fx = sin(ix*pi*ax)./(pi*ix);
  37. fy = sin(iy*pi*ay)./(pi*iy);
  38. FX = sin(IX*pi*ax)./(pi*IX);
  39. FY = sin(IY*pi*ay)./(pi*IY);
  40. FB(yno+1:2*yno-1,xno) = ax*fy;
  41. FB(yno-1:-1:1,xno) = FB(yno+1:2*yno-1,xno);
  42. FB(yno,xno+1:2*xno-1) = ay*fx;
  43. FB(yno,xno-1:-1:1) = FB(yno,xno+1:2*xno-1);
  44. FB(yno+1:2*yno-1,xno+1:2*xno-1) = FX.*FY;
  45. FB(yno+1:2*yno-1,xno-1:-1:1) = FB(yno+1:2*yno-1,xno+1:2*xno-1);
  46. FB(yno-1:-1:1,xno+1:2*xno-1) = FB(yno+1:2*yno-1,xno+1:2*xno-1);
  47. FB(yno-1:-1:1,xno-1:-1:1) = FB(yno+1:2*yno-1,xno+1:2*xno-1);
  48. FE{1,1} = (eps1 - eps2)*FB;
  49. FE{1,2} = (1/eps1 - 1/eps2)*FB;
  50. FE{1,1}(yno,xno) = eps2 + (eps1 - eps2)*ax*ay;
  51. FE{1,2}(yno,xno) = 1/eps2 + (1/eps1 - 1/eps2)*ax*ay;
  52. end
  53. %
  54. % end of calc_emntd_lam
  55. %