sim_time=[500e-15, 3000e-15]; for (i=1:2) { # run simulation for a short time switchtolayout; setnamed("FDTD","simulation time",sim_time(i)); run; runanalysis; # plot time signal m="mode profile and Q::Q analysis::t1"; t=getdata(m,"t"); E2=pinch(getelectric(m)); plot(t*1e15,E2,"time (fs)","|E|^2","Simulation time: "+num2str(sim_time(i)*1e15)+"fs"); # plot the raw data from the field monitor m="mode profile and Q::profile"; x=getdata(m,"x"); y=getdata(m,"y"); E2_full=getelectric(m); image(x*1e6,y*1e6,E2_full,"x (um)","y (um)","Raw fields"); # plot field profile after the fields are re-scaled # by the appropriate amount m="mode profile and Q"; x=getdata(m,"x"); y=getdata(m,"y"); E2_apod_corrected=getdata(m,"E2"); scale_factor=getdata(m,"field_scale_factor"); image(x*1e6,y*1e6,E2_apod_corrected,"x (um)","y (um)","Corrected fields. Scaling="+num2str(scale_factor^2)); }