Hi
im trying to solve a proble in EM with method of MAS ( METHOD OF AUXILARY SOURCE)
I have a infiite cylinder ( PERFECT CONDUCTOR) and in incominf fileld strike the cylinder FROM THE Ein+Escat=0 in the surface of cylinder i solve th system and i fins the current Is ( the function is the currentMAS()) . After i find the Escat field form the epresion of MAS theort. After the i check the sumEs_surf =abs(Etotal(xs,ys)) Etotal= Escat(x,y)+E_in_z(x,y) xs=ra cos(phi) ys=cos(phi) rho = ra;
phi =2*pi*(0:Nc-1)/Nc% Create phi values
% Compute Cartesian coordinates (xa, ya)
xs = rho .* cos(phi); % x-coordinates
ys = rho .* sin(phi); % y-coordinates
the sum is not equal to zero !! the real part is zero but the imaginary not
function [Is] = currentMAS()
%UNTITLED Summary of this function goes here
% Detailed explanation goes her
[~,N,Nc,a,ra,k0,Z0,~] = parameter();
% Preallocate arrays for efficiency
xc = ra * cos(2 * pi * (0:N-1)/N); % Observation points (x-coordinates)
yc = ra* sin(2 * pi*(0:N-1)/N); % Observation points (y-coordinates)
xa = a * cos(2 * pi * (0:Nc-1) / Nc); % Source points (x-coordinates)
ya = a * sin(2 * pi * (0:Nc-1) / Nc); % Source points (y-coordinates)
% Compute distance matrix R between source and observation points
[Xa, XC] = meshgrid(xa, xc); % Observation (columns), Source (rows)
[Ya, YC] = meshgrid(ya, yc);
Ra= sqrt((Xa - XC).^2 + (Ya - YC).^2);
% Compute matrix WI based on the Green's function
WI = (1 / 4) * k0 * Z0 .* besselh(0, 2, k0 .* Ra);
% Compute the source field at each source point
Source = arrayfun(@(xi, yi)E_in_z(xi,yi),xc,yc);
%Source = E_in_z(xc, 0);
%Is = linsolve(WI, Source');
%lambda = 1e-1; % Regularization factor
%Is = (WI' * WI + lambda * eye(size(WI, 2))) \ (WI' * Source');
Is =(pinv(WI)* Source')
end
function z = Escat(x, y)
% Get the current values from the input parameters
[Is] = currentMAS()
[f,N,Nc,a,ra,k0,Z0,lambda] = parameter();
% Precompute coordinates of the points
xx = a * cos(2 * pi * (0:Nc-1) / Nc); % Length Nc
yy = a * sin(2 * pi * (0:Nc-1) / Nc); % Length Nc
% Initialize the S_UM for each (x, y) pair
E_scat = zeros(size(x)); % Result will be the same size as x and y
% Compute the distances and the contributions for each (x, y) pair
for jj = 1:Nc
RR = sqrt((x - xx(jj)).^2 + (y - yy(jj)).^2); % Calculate distance for all (x, y)
% Sum the contributions (note the broadcasting)
E_scat = E_scat - (1/4).*Is(jj) .* k0 * Z0 .* besselh(0, 2, k0 .* RR);
end
% Output the computed value
z = E_scat;
end
function [f,N,Nc,a,ra,k0,Z0,lambda] = parameter()
%UNTITLED Summary of this function goes here
c0=3e8;
Z0=120.*pi;
ra=1;
a=0.85;
N=120;
Nc=120;
f=300e6;
lambda=c0./f;
k0=2*pi./lambda;
end
function y = Etotal(x,y)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
y=Escat(x,y)+E_in_z(x,y);
end
function z=E_in_z(x,y)
%amplitude
[f,N,Nc,a,ra,k0,Z0] = parameter();
E0=1;
z=E0.*exp(1i.*k0*x);
end
I Atach the mathematical description
tnank you
i wish a happy new year