% Title: Simulation of transformation optics designed metamaterial for electromagnetic cloaking
% Author: Koppny Krmczi
%-------------------------------------------------------------------------%
% Description: This software is a finite element method based solver for
% studying the electromagnetic cloaking effect. This
% program is distributed in the hope that it will be useful
% to demonstrate that the transformation optics designed
% metamaterial cloak works properly under finite length
% line and point source illumination as well. Additionally
% the program includes both types of sources, and the exact
% and reduced metamaterial parameters too. The choice is
% available with the following parameters.
% You can choose: parameter a: 0 - point source case (default)
% 1 - finite length line source case
% parameter b; 0 - with exact metamaterial parameters (default)
% 1 - with reduced metamaterial parameters
% Constans: magnetic permeability: 4*pi*10^(-7)
% electric permittivity: 8.8541878176*10^(-12)
% conductivity of copper: 5.9523809523*10^7
% speed of light in vacuum/air: 2.9979245800*10^8
% frequency of the EM wave: 8.5*10^9
%-------------------------------------------------------------------------%
function EM_Cloaking
%-------------------------------------------------------------------------%
a=0; % parameter a: choice of the source type (default:0)
b=0; % parameter b: choice of the metamaterial type (default:0)
%-------------------------------------------------------------------------%
[pde_fig,ax]=pdeinit;
pdetool('appl_cb',1);
set(ax,'DataAspectRatio',[1 1 1]);
set(ax,'PlotBoxAspectRatio',[1159.4666666666667 607.5 4556.2500000000009]);
set(ax,'XLimMode','auto');
set(ax,'YLim',[-0.20000000000000001 0.20000000000000001]);
set(ax,'XTick',[ -0.20000000000000001,...
-0.15000000000000002,...
-0.10000000000000001,...
-0.049999999999999989,...
0,...
0.049999999999999989,...
0.10000000000000001,...
0.15000000000000002,...
0.20000000000000001,...
]);
set(ax,'YTick',[ -0.20000000000000001,...
-0.15000000000000002,...
-0.10000000000000001,...
-0.049999999999999989,...
0,...
0.049999999999999989,...
0.10000000000000001,...
0.15000000000000002,...
0.20000000000000001,...
]);
pdetool('gridon','on');
% Geometry description: copper cylinder, metamaterial cloak and the PML
pderect([-0.114231297103992 0.114231297103992 0.114231297103992 -0.114231297103992],'SQ1');
pderect([0.15000000000000002 -0.14999999999999997 -0.14999999999999999 0.14999999999999999],'SQ2');
pdecirc(0,0,0.027099999999999999,'C1');
pdecirc(0,0,0.058900000000000001,'C2');
%-------------------------------------------------------------------------%
% Geometry of the source:
if a==0 %if a=0, point source case
pdecirc(-0.074999999999999997,0,0.001,'C3');
elseif a==1 %if a=1, finite length line source case
pderect([-0.095000000000000001 -0.10000000000000001 0.10000000000000001 -0.10000000000000001],'R1');
pdecirc(-0.097500000000000003,-0.10000000000000001,0.0025000000000000001,'C3');
pdecirc(-0.097500000000000003,0.10000000000000001,0.0025000000000000001,'C4');
end
%-------------------------------------------------------------------------%
pdepoly([ 0.114231297103992,...
0.14999999999999999,...
-0.14999999999999999,...
-0.114231297103992,...
],...
[ 0.114231297103992,...
0.14999999999999999,...
0.14999999999999999,...
0.114231297103992,...
],...
'P1');
pdepoly([ 0.114231297103992,...
0.14999999999999999,...
0.14999999999999999,...
0.114231297103992,...
],...
[ 0.114231297103992,...
0.14999999999999999,...
-0.14999999999999999,...
-0.114231297103992,...
],...
'P2');
pdepoly([ 0.114231297103992,...
0.14999999999999999,...
-0.14999999999999999,...
-0.114231297103992,...
],...
[ -0.114231297103992,...
-0.14999999999999999,...
-0.14999999999999999,...
-0.114231297103992,...
],...
'P3');
pdepoly([ -0.114231297103992,...
-0.14999999999999999,...
-0.14999999999999999,...
-0.114231297103992,...
],...
[ 0.114231297103992,...
0.14999999999999999,...
-0.14999999999999999,...
-0.114231297103992,...
],...
'P4');
%-------------------------------------------------------------------------%
if a==0 %if a=0, point source case
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','((SQ1+SQ2*P1+SQ2*P2+SQ2*P3+SQ2*P4)+C1+C2)-C3')
elseif a==1 %if a=1, finite length line source case
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','(SQ1+SQ2+C1+C2+P1+P2+P3+P4)-(R1+C3+C4)')
end
%-------------------------------------------------------------------------%
% Boundary conditions:
pdetool('changemode',0)
%source implementation with inhomogeneous Dirichlet boundary condition: u=1
%-------------------------------------------------------------------------%
if a==0 %if a=0, point source case
pdesetbd(25,...
'dir',...
1,...
'1',...
'1')
pdesetbd(24,...
'dir',...
1,...
'1',...
'1')
pdesetbd(23,...
'dir',...
1,...
'1',...
'1')
pdesetbd(22,...
'dir',...
1,...
'1',...
'1')
elseif a==1 %if a=1, finite length line source case
pdesetbd(26,...
'dir',...
1,...
'1',...
'1')
pdesetbd(25,...
'dir',...
1,...
'1',...
'1')
pdesetbd(24,...
'dir',...
1,...
'1',...
'1')
pdesetbd(23,...
'dir',...
1,...
'1',...
'1')
pdesetbd(12,...
'dir',...
1,...
'1',...
'1')
pdesetbd(11,...
'dir',...
1,...
'1',...
'1')
end
%-------------------------------------------------------------------------%
%outward border of the PML (homogeneous Dirichlet boundary condition: u=0
pdesetbd(10,...
'dir',...
1,...
'1',...
'0')
pdesetbd(9,...
'dir',...
1,...
'1',...
'0')
pdesetbd(3,...
'dir',...
1,...
'1',...
'0')
pdesetbd(1,...
'dir',...
1,...
'1',...
'0')
% Mesh generation: 4x refinement with jiggle (approx. 250000 triangles)
% For computers with lower performance less refinement is recommended
setappdata(pde_fig,'Hgrad',1.3);
setappdata(pde_fig,'refinemethod','regular');
setappdata(pde_fig,'jiggle',char('on','mean','20'));
pdetool('initmesh')
pdetool('refine')
pdetool('refine')
pdetool('refine')
pdetool('refine')
pdetool('jiggle')
% PDE coefficients for the PML region, vacuum or air, copper cylinder and the
% metamaterial cloak:
%-------------------------------------------------------------------------%
if a==0
if b==0 %if a=0 & b=0, exact metamaterial parameters and point source case
pdeseteq(1,...
str2mat('1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*(1./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*((y./x).^2./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))!1','0!0!0!0!0!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))!0','0!0!0!0!0!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))!0','1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*((y./x).^2./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*(1./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))!1'),...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2).*((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7))',...
'0!0!0!0!0!0!0',...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setappdata(pde_fig,'currparam',...
['1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*(1./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*((y./x).^2./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))) (((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))) (((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))) ((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*((y./x).^2./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*(1./(1+(y./x).^2)))./((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))!1';...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2).*((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7)) ';...
'0!0!0!0!0!0!0 ';...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0 '])
elseif b==1 %if a=0 & b=1, reduced metamaterial parameters and point source case
pdeseteq(1,...
str2mat('1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*(1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))))!1','0!0!0!0!0!(-1.*(-1.*(((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))))!0','0!0!0!0!0!(-1.*(-1.*(((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))))!0','1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((y./x).^2./(1+(y./x).^2))+(1./(1+(y./x).^2)))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))))!1'),...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2)))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7))',...
'0!0!0!0!0!0!0',...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setappdata(pde_fig,'currparam',...
['1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*(1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))) (-1.*(-1.*(((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))) (-1.*(-1.*(((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2))))) (((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((y./x).^2./(1+(y./x).^2))+(1./(1+(y./x).^2)))./((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))))!1';...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2)))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7)) ';...
'0!0!0!0!0!0!0 ';...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0 '])
end
elseif a==1
if b==0 %if a=1 & b=0, exact metamaterial parameters and finite length line source case
pdeseteq(1,...
str2mat('1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!1!((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*(1./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*((y./x).^2./(1+(y./x).^2))','0!0!0!0!0!0!((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2)))','0!0!0!0!0!0!((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2)))','1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1!((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*((y./x).^2./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*(1./(1+(y./x).^2))'),...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2).*((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))))',...
'0!0!0!0!0!0!0',...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setappdata(pde_fig,'currparam',...
['1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1!((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*(1./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*((y./x).^2./(1+(y./x).^2)) ((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2))) ((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))-(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))).*((y./x)./(1+(y./x).^2))) ((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).*((y./x).^2./(1+(y./x).^2))+(1./((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5))).*(1./(1+(y./x).^2))';...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2).*((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)))) ';...
'0!0!0!0!0!0!0 ';...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0 '])
elseif b==1 %if a=1 & b=1, reduced metamaterial parameters and finite length line source case
pdeseteq(1,...
str2mat('1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9))!1!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*(1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2))','0!0!0!0!0!0!(((((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2))','0!0!0!0!0!0!(((((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2))','1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((y./x).^2./(1+(y./x).^2))+(1./(1+(y./x).^2)))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2))'),...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2)))',...
'0!0!0!0!0!0!0',...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0',...
'0:10',...
'0.0',...
'0.0',...
'[0 100]')
setappdata(pde_fig,'currparam',...
['1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1!1./(1+i.*(2.9979245800*10^8./(0.15+x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15+y))/(2*pi*8.5*10^9))!1./(1+i.*(2.9979245800*10^8./(0.15-x))/(2*pi*8.5*10^9)) 1./(1+i.*(2.9979245800*10^8./(0.15-y))/(2*pi*8.5*10^9))!1!(((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*(1./(1+(y./x).^2))+((y./x).^2./(1+(y./x).^2)))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)) (((((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)) (((((y./x)./(1+(y./x).^2)).*(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)-((y./x)./(1+(y./x).^2))))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2)) (((((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2).*((y./x).^2./(1+(y./x).^2))+(1./(1+(y./x).^2)))./(((((x.^2+y.^2).^0.5)-0.0271)./((x.^2+y.^2).^0.5)).^2))';...
'-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*0-i*5.9523809523*10^7/(2*pi*8.5*10^9))*(4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7))!-(2*pi*8.5*10^9)^2*(8.8541878176*10^(-12)*4*pi*10^(-7).*(((0.0589/(0.0589-0.0271))^2))) ';...
'0!0!0!0!0!0!0 ';...
'1.0!1.0!1.0!1.0!1.0!1.0!1.0 '])
end
end
%-------------------------------------------------------------------------%
% Solve parameters:
setappdata(pde_fig,'solveparam',...
str2mat('0','393216','10','pdeadworst',...
'0.5','longest','0','1E-4','','fixed','Inf'))
% Plotflags and user data strings:
setappdata(pde_fig,'plotflags',[1 1 1 1 1 1 7 1 0 0 0 1 1 0 0 0 0 1]);
setappdata(pde_fig,'colstring','');
setappdata(pde_fig,'arrowstring','');
setappdata(pde_fig,'deformstring','');
setappdata(pde_fig,'heightstring','');
% Solve PDE:
pdetool('solve');
%-------------------------------------------------------------------------%
%-------------------------------------------------------------------------%
%-------------------------------------------------------------------------%
% To animate the illumination and the cloaking effect, export the mesh
% data and the solution vector from the Matlab PDE Toolbox's GUI to the
% workspace, then open and start the attached Animation.m file.