#run the sweep runsweep("polarization_duty_cycle_sweep"); # get the sweep results, transmission and gradting width. As T is a dataset, dot operator is used as well T_sweep = getsweepresult("polarization_duty_cycle_sweep","T"); duty_cycle = getsweepdata("polarization_duty_cycle_sweep","duty_cycle"); T = T_sweep.T; f = T_sweep.f; #T is a matrix of size 3x10x2. Extract p polarization transmission data and s polarization transmission data, #for the mid frequency, the 2nd of the 3 frequencies P = pinch(pinch(T,3,1),1,2); S = pinch(pinch(T,3,2),1,2); #Calculate the Contrast ratio C = P/S; # Plot the contrast ratio, P polarization transmission, and S polarisation transmission plot(duty_cycle,C,"Duty cycle","Contrast Ratio (logplot)","","logplot"); plot(duty_cycle,-S,"Duty cycle","S transmission (logplot)","","logplot"); plot(duty_cycle,-P,"Duty cycle","P transmission");