#!/usr/bin/gnuplot # plots the combined effects of a LASER-medium and a resonator on the allowed frequencies for the resulting LASER # created by Michael G. Hansen # released under the GNU GPL # we plot using the frequency, hence nu is a dummy set dummy nu # m(nu) describes the LASER-medium-gain: nu_medium_0 = 30 nu_medium_width = 10 m(nu)=2*exp(-(nu-nu_medium_0)**2/nu_medium_width**2) # r(nu) describes the resonance of the resonator: nu_resonator_0 = 10 nu_resonator_0 = 6 nu_resonator_width = 1 # shift the resonator a few resonances to the left, so it coincidences with the LASER-medium: nu_resonator_basemult = 5 # we plot 3 peaks in both directions from the center: r(nu) = exp(-((nu-nu_resonator_basemult*nu_resonator_0)/nu_resonator_width)**2) \ +exp(-((nu-(nu_resonator_basemult+1)*nu_resonator_0)/nu_resonator_width)**2) \ +exp(-((nu-(nu_resonator_basemult-1)*nu_resonator_0)/nu_resonator_width)**2) \ +exp(-((nu-(nu_resonator_basemult+2)*nu_resonator_0)/nu_resonator_width)**2) \ +exp(-((nu-(nu_resonator_basemult-2)*nu_resonator_0)/nu_resonator_width)**2) \ +exp(-((nu-(nu_resonator_basemult+3)*nu_resonator_0)/nu_resonator_width)**2) \ +exp(-((nu-(nu_resonator_basemult-3)*nu_resonator_0)/nu_resonator_width)**2) # combined effect: medium and resonator b(nu)=m(nu)*r(nu) # configure the plot: set yrange[0:2] set xrange[0:60] set xtics 5 set mxtics 1 # make sure we have enough samples so that the Gaussians display nicely: set samples 1200 set xlabel "Frequency / A.U." set ylabel "Intensity" # plot the three functions: set terminal svg set output "resonator_and_medium.svg" plot m(nu) with lines smooth csplines title "Medium", r(nu) smooth acsplines with lines title "Resonator", b(nu) with lines smooth acsplines title "Combined" set output