# script to generate 3d scatter plotting # # Copyright Lumerical Solutions Inc, 2010 m_name = "monitor2"; thresh = 1.3; # set threshold, fields above this value will be shown mon=pinch(getelectric(m_name),4,1); # picks the first freq xmon=getdata(m_name,"x"); ymon=getdata(m_name,"y"); zmon=getdata(m_name,"z"); n=size(xmon); n=n(1); # setup empty arrays s=sum(mon>thresh); x=matrix(1,s); y=matrix(1,s); z=matrix(1,s); e=matrix(1,s); # get positions of (x,y,z) over threshold value t=1; for(i=1:n) { for(j=1:n) { for(k=1:n) { if(abs(mon(i,j,k))>thresh) { x(t)=xmon(i); y(t)=ymon(j); z(t)=zmon(k); e(t)=abs(mon(i,j,k)); t=t+1; } } } } # write data to a txt file to be imported into Matlab f="e_field.txt"; del(f); write(f,num2str(x)); write(f,num2str(y)); write(f,num2str(z)); write(f,num2str(e));