# 怎么使用Pabs 监视器得到absorption和x轴的图像

1 Like

Pabs=getresult（“Pabs”，“Pabs”）；
？integrate2（Pabs,[2,3],y,z）;

x=Pabs.x;
y=Pabs.y;
z=Pabs.z;
p=Pabs.Pabs;
pp=integrate2（p,[2,3],y,z）;

1 Like

x=getdata(“field”,“x”);
y=getdata(“field”,“y”);
z=getdata(“field”,“z”);
f=getdata(“field”,“f”);
nx=length(x);
ny=length(y);
nz=length(z);
nf=length(f);

E2_matrix=getelectric(“field”);
if (havedata(“index”,“index_x”)) {
n_matrix=getdata(“index”,“index_x”);
} else {
n_matrix=getdata(“index”,“index_z”);
}

W=meshgrid4d(4,x,y,z,f2pi); # create 4D matrix of f and sourcepower that
SP=meshgrid4d(4,x,y,z,sourcepower(f)); # that is the same size as E2 and n

################################################

# as a function of x,y,z,f

epsilon = eps0n_matrix^2;
Pabs_matrix = 0.5
WE2_matriximag(epsilon);

# Pabs would have units of Watts / m^3

Pabs_matrix = Pabs_matrix / SP;

# source power absorbed in the volume.

Pabs_integrated = integrate2(Pabs_matrix,1:3,x,y,z);

# create data sets

Pabs = rectilineardataset(“Pabs”,x,y,z);

Pabs_total = matrixdataset(“Pabs_total”);**************为什么前面不用定义Pabs_total ？

Pabs=getresult（“Pabs”，“Pabs”）；
x=Pabs.x;
y=Pabs.y;
z=Pabs.z;
p=Pabs.Pabs;
pp=integrate2（p,[2,3],y,z）;

A：这个是定义Dataset用的。参见Dataset的帖子