Hi, I finished a simulation on photothermal heating with 3D temperature monitor and wanted to do 3D plotting in matlab. I wanted to make a similar graph below, but there were some problems in getting data from T monitor and doing the Device-matlab interconnection.

The script below was from a 3D plotting example for E-field in KB, https://kb.lumerical.com/en/index.html?ref_scripts_tutorial_matlab.html. Problems are in brackets in bold.

m_name = “monitor2”;

thresh = 1.3; # set threshold, fields above this value will be shown **(How to set this value in T field)**

mon=pinch(getelectric(m_name),4,1); # picks the first freq **(How to script for T field, “gettemperature”?)**

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);

ef=matrix(1,s);

# get positions of (x,y,z) over threshold value

t=1; #counter

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);

ef(t)=abs(mon(i,j,k)); **(How to script for T in this line? )**

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(ef));

% simple matlab script that plots single frequency 3D monitor data

e_field=dlmread(‘e_field.txt’,’\t’); % tab delimited

a=e_field(1,:); % x

b=e_field(2,:); % y

c=e_field(3,:); % z

e=e_field(4,:); % e-field value

size=25; % rendering size of plotted points

% plot the data and label

scatter3(a*1e6,b*1e6,c*1e6,size,e); **( Still “scatter”?)**

xlabel(‘x-axis (um)’);

ylabel(‘y-axis (um)’);

zlabel(‘z-axis (um)’);