-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_script.m
58 lines (46 loc) · 2.11 KB
/
test_script.m
1
% GNU General Public License v3.0 | Copyright (c) 2022 Alexandros Pitilakisclear all; close all; clc;% This script produces a test configuration for the metasruface (e.g. a% grating, and a circular aperture) and calculates & plots the scattering% pattern for an obliquely-incident plane wave illumination.%% This particular grating implements an (approximately) retro-reflecting% metasurface, when illuminated from theta=30 deg (oblique incidence). You% can compare this pattern against the the specular reflection pattern,% by setting pp=0*pp (i.e., like a flat metallic reflector plate).% ----------- Test Configuration for Metasurface ------------% Define a phase-grating on the metasurfaceN=40;[nn,mm] = meshgrid( 1:N,1:N );pp = zeros(size(nn));per = 10;pp( mod(nn,per)<=((per-1)/2) ) = pi; % pp == phase_profile% Define a circular aperture (absorbing cells at the four corners)ap = ones(size(pp));dd = sqrt( (nn-N/2).^2 + (mm-N/2).^2 );ap( dd > N/2 ) = 0; % ap = amplitude_profile% ----------- Function Inputs ------------freq = 1e12; % [Hz] Operating frequncywl = 3e8 / freq;MetaSurf.duc = wl/10; % [m] cell-width (square)MetaSurf.NumCellsXY = [ N N ]; % [.] number of cells in each dimensionMetaSurf.Refl_Ampli = ap; % [rad]MetaSurf.Refl_Phase = pp; % [.]MetaSurf.Cell_ScatPat_Exp = 1; % [.] cell-scat-pat is cos(theta)^nIllumin.Type = 1; % Illumination/source type: 1=Plane, else=SphericalIllumin.DOA = [ 30 , 0 ]; % [deg] theta+phi angles (for Type==1)Illumin.xyz = [ 0 , 0 , 3e8/freq*5 ]; % [m] sphere center (for Type~=1)Method.SPAR = 3; % [deg] % SPAR: Scattering-Pattern Angle-ResolutionMethod.angspan = 0; % [deg] if set to zero, we scan entire hemisphereMethod.focusDir = [0,0]; % [deg](theta,phi) to "focus" calc on% ----------- Call function to calc. scat-patt -----------[E, theta, phi] = calc_ScatPat( freq , MetaSurf , Illumin , Method );Unorm = abs(E).^2/max(abs(E(:)).^2);% ----------- Plot scat-patt ----------- try figure; plot_3D_Pattern( theta*180/pi, phi*180/pi, Unorm , [3 6] ) colormap jet catch error( ' Get "plot_3D_Pattern" from GitHub to plot the pattern!' )end