EDIT: I found a small error in the code. I was not including the right factors of r(j) for the transmitted fields in the line beginning coefs_e(:,j) = ... . This has been fixed now.
I made a MATLAB function that will calculate and plot a reflection/transmission spectrum for an arbitrary cavity (any number of mirrors, any distances between them). The m file is attached, and I have pasted the documentation below for reference. I figured it might be useful for this oftencountered calculation.
Here is a sample output for the aLIGO PMC:
%ARBCAV  ARBitrary CAVity calculator
%Zach Korth  05/08/2010
%
%arbcav(T,L,loss,lambda,num_pts) takes information about an arbitrary cavity
%and returns a transmission/reflection coefficient spectrum for the cavity,
%as well as the finesse.
%
% Arguments:
%
% T: vector containing the power transmission coefficients (i.e. T(i) = T
% of the ith mirror)
%
% L: vector containing distances between mirrors (i.e. L(1) = distance
% from mirror 1 to mirror 2; final element is the distance from the last
% mirror back to mirror 1). Note that for a linear cavity you must
% treat the return leg as an extra distance (e.g. for a linear 2mirror
% cavity of 1m length, L = [1 1], etc).
%
% loss: power loss of each mirrorassumed to be the same for all
%
% lambda: nominal laser wavelength
%
% num_pts: number of points for scan
%
% Outputs:
%
% finesse: duh
%
% coefs: a matrix of size(num_pts,length(L)) containing the power
% coupling coefficients between the input coupler (mirror 1) and each
% cavity mirror (i.e. coefs(:,1) = the cavity reflection coefficient,
% coefs(:,j) = the transmission coefficient between the input coupler and
% the jth mirror
%
% delta_f: frequency vector along which to plot coefs(:,i)
%
