How to plot poynting vector profile by using electric and magnetic filed components ?

18 次查看(过去 30 天)
HERE I AM ADDING CODE
here I have to plot Quiver plot for poynting vector components Sy,Sz;
how to get position matrices y, z of this components Sy,Sz
clear all;
clc;
close all;
dim=32;
[kx,ky]=meshgrid(-1:2/(dim-1):1);
circ=sqrt(kx.^2+ky.^2)<1;
alp=asin(0.8);
k0=1/sin(alp);
k=128;
kz=sqrt(k0^2-(kx.^2+ky.^2));
Gx=sqrt(k0./kz).*((k0*ky.^2+kz.*kx.^2)./(k0*(kx.^2+ky.^2)));
Gy=sqrt(k0./kz).*((kz-k0).*kx.*ky)./(k0*(kx.^2+ky.^2));
Gz=sqrt(k0./kz).*(kx./k0);
sx=kx/k0;
sy=ky/k0;
sz=kz/k0;
ph=(atan2(kx,ky)+pi);
ph2=3*(atan2(kx,ky)+pi);
abr=exp(1i*ph2);
ph=rot90(ph,3);
la=-sin(ph);
lb=rot90(cos(ph),3);
lamda=531e-9;
z=-64:1:63;
c = numel(z);
Fx=(sy.*Gz-sz.*Gy);
Fy=(sz.*Gx-sx.*Gz);
Fz=(sx.*Gy-sy.*Gx);
mz=pi/((2*tan(alp/2)));
n = size(kx);
Ex = zeros([k k c]);
Ey = zeros([k k c]);
Ez = zeros([k k c]);
for jj=1:c
Exx(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*(Gx.*la.*circ.*abr),k,k));
Exy(:,:,jj)=fftshift(fft2(rot90(exp(1i*kz*mz*z(jj)).*Gy.*lb.*circ,3).*abr,k,k));
Ex=Exx-Exy;
Eyx(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*(Gy.*la.*circ.*abr),k,k));
Eyy(:,:,jj)=fftshift(fft2(rot90(exp(1i*kz*mz*z(jj)).*Gx.*lb.*circ,3).*abr,k,k));
Ey=Eyx+Eyy;
Ezx(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*(Gz.*la.*circ.*abr),k,k));
Ezy(:,:,jj)=fftshift(fft2(rot90(exp(1i*kz*mz*z(jj)).*Gz.*lb.*circ,3).*abr,k,k));
Ez=Ezx+Ezy;
Bxx(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*(Fx.*la.*circ.*abr),k,k));
Bxy(:,:,jj)=fftshift(fft2(rot90(exp(1i*kz*mz*z(jj)).*Fy.*lb.*circ,3).*abr,k,k));
Bx=Bxx+Bxy;
Byx(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*(Fy.*la.*circ.*abr),k,k));
Byy(:,:,jj)=fftshift(fft2(rot90(exp(1i*kz*mz*z(jj)).*Fx.*lb.*circ,3).*abr,k,k));
By=Byx+Byy;
Bzx(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*(Fz.*la.*circ.*abr),k,k));
Bzy(:,:,jj)=fftshift(fft2(rot90(exp(1i*kz*mz*z(jj)).*Fz.*lb.*circ,3).*abr,k,k));
Bz=Bzx+Bzy;
end
Ex=Ex(k/2,:,:);
Ey=Ey(k/2,:,:);
Ez=Ez(k/2,:,:);
Ex=squeeze(Ex);
Ey=squeeze(Ey);
Ez=squeeze(Ez);
Bx=Bx(k/2,:,:);
By=By(k/2,:,:);
Bz=Bz(k/2,:,:);
Bx=squeeze(Bx);
By=squeeze(By);
Bz=squeeze(Bz);
Sx=(Ey.*Bz-Ez.*By);
Sy=(Ez.*Bx-Ex.*Bz);
Sz=(Ex.*By-Ey.*Bx);
I=Ex.*conj(Ex)+Ey.*conj(Ey)+Ez.*conj(Ez);
figure(1)
imagesc(I),colormap gray
figure(2)
Quiver(y,z,abs(Sy),abs(Sz),0.5), how to get y,z from Sy,Sz
Hi,
here I calculated Poynting vector by using electric and magnetic field
components, I facing problem to plot poynting vector by using Quiver plot,
to plot Quiver plot in YZ plane I have Y and Z components of poynting vector,but
to plot Quiver plot I required position of this components,
Here poynting vector components have 128*128 pixel dimensions,
I required position vector y,z
HERE I AM ADDING CODE
here I have to plot Quiver plot for poynting vector components Sy,Sz; how to get position matrices y, z of this components Sy,Sz
How can I get this position matrixes from components of poynting vector?
to plot Quiver(y,z,(Sy),(Sz)) y,z=?
can anyone help me in this regard to get the position matrices?
thanks in advance
  3 个评论
Jonathan Epperl
Jonathan Epperl 2012-12-26
Okay, maybe I wasn't clear enough, either.
By sample code I mean a minimal example that runs by itself and illustrates your problem, not your entire 100 something lines of code, because you really shouldn't expect us to read through all of that...

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by