1.lsf文件
# define position vectors
x = linspace(-2e-6,2e-6,100);
y = linspace(-2e-6,2e-6,101);
z = 0;
X = meshgrid3dx(x,y,z);
Y = meshgrid3dy(x,y,z);
Z = meshgrid3dz(x,y,z);
# define field profile to import
Ex = exp( - (X/1e-6)^2 - (Y/1e-6)^2 );
Ey = 0*X;
Ez = 0*X;
Hx = 0*X;
Hy = sqrt(eps0/mu0)*Ex;
Hz = 0*X;
# create dataset
EM = rectilineardataset("EM fields",x,y,z);
EM.addattribute("E",Ex,Ey,Ez);
EM.addattribute("H",Hx,Hy,Hz);
# save dataset to .mat file which can be imported
matlabsave("testfields.mat",EM);