|
the integrand is ( E cross H* ) dot da d(theha) d(phi)
the boundaries are thetha=[0 pi], phi=[0 2pi]
the function that calculates it is below
function [loss_EM_energy, Electric_Ftotal]= poynting_on_surface(waveVec, Pvector, dipole_array_pos, error)
r_size=5*10^-8;
dipole_array_pos=dipole_array_pos(:,1:3);
waveVec_size=norm(waveVec);
omega=c*waveVec_size;
loss_EM_energy = quad2d(@fun,0,pi,0,2*pi,'AbsTol', error);
function integrand=fun(thetha,phi)
integrand=zeros(size(thetha));
for ThethaInd=1:size(thetha,2)
for phiInd=1:size(phi,1)
[x,y,z] = sph2cart(thetha(phiInd,ThethaInd),phi(phiInd,ThethaInd),r_size);
Einc=incident_field(waveVec, [x y z]);
Electric_Ftotal=Einc;
HField_total=cross(waveVec,Einc)/(omega*4*pi*10^-7);
for dipole_part_num=1:size(dipole_array_pos,1)
dipole_array_vector=Pvector(3*dipole_part_num-2:3*dipole_part_num).';
vec_dip_point=[x,y,z] -dipole_array_pos(dipole_part_num,:);
vec_dip_point_norm=vec_dip_point/norm(vec_dip_point);
dist_dip_point=norm(vec_dip_point);
GreenTerm=exp(-1i*waveVec_size*dist_dip_point)/dist_dip_point;
ElecField=(waveVec_size^2*(cross(cross(vec_dip_point_norm,dipole_array_vector),vec_dip_point_norm))+(3*vec_dip_point_norm*dot(vec_dip_point_norm,dipole_array_vector)-dipole_array_vector)*(1/dist_dip_point^2+1i*waveVec_size/dist_dip_point))*GreenTerm;
ElecField_div_epsilon=ElecField/(4*pi*epsilon_b);
Electric_Ftotal=Electric_Ftotal+ElecField_div_epsilon;
HField=(c*waveVec_size^2/(4*pi))*cross(vec_dip_point_norm,dipole_array_vector)*GreenTerm*(1+1/(1i*waveVec_size*dist_dip_point));
HField_total=HField_total+HField;
end
poynting_vector=cross(Electric_Ftotal,conj(HField_total));
da=r_size^2*sin(thetha(phiInd,ThethaInd))*[x y z]/r_size;
integrand(phiInd,ThethaInd)=integrand(phiInd,ThethaInd)+dot(poynting_vector,da);
end
end
end
end
"Steven_Lord" <slord@mathworks.com> wrote in message <jq7s4s$sjn$1@newscl01ah.mathworks.com>...
>
>
> "doron bartov" <doronbartov@gmail.com> wrote in message
> news:jq79d1$cuh$1@newscl01ah.mathworks.com...
> > i am calculating an electro magnetic physical quantity- the cross factor
> > of the electric field and magnetic field emerging from an electric dipole.
> > my limits are : thetha=[0-pi], phi=[0-2pi].
> > when i set tollerance values it did not help the accuracy.
> > i know (not sure) the answer from the answer of the other side of the
> > equation (dot(E,J))
>
> Can you show the integral you're trying to compute and the code that you
> wrote to compute it? Perhaps one of the readers of the group can detect if
> there's a typo or other type of error in the code.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
|