######################################################### # file: power_vs_r.lsf # # Description: # This script sweeps through the specified # range of defect radii and plots the # normalized reflection/transmission as a # function of radius # # Copyright 2010, Lumerical Solutions, Inc. ######################################################### clear; # define the range of values for the defect radius p = 35+1; r = linspace(0,0.35e-6,p); t_bottom = matrix(p,1); t_right = matrix(p,1); t_left = matrix(p,1); t_top = matrix(p,1); for (i=1:p) { # print progress update to the screen ?"Working on simulation " + num2str(i) + " of " + num2str(p); # set the defect radius switchtolayout; setnamed("PC_defect","defect_radius",r(i)); run(3); # collect simulation data t_bottom(i) = -transmission('T_bottom'); t_right(i) = transmission('T_right'); t_left(i) = transmission('T_left'); t_top(i) = 1-transmission('T_top'); } # normalize transmission # with power through T_left (the injection plane) t_bottom_norm = t_bottom*(t_left); t_right_norm = t_right*(t_left); t_bottom_norm = t_bottom_norm/(t_bottom_norm + t_right_norm); t_right_norm = t_right_norm/(t_bottom_norm + t_right_norm); # plot normalized transmission plot(r*1e6,t_bottom_norm,t_right_norm,'r_d/a','normalized power'); legend('reflected power','transmitted power');