function fDC2=propagateField(fDC, vMod, L, n, lambda) % Propagate optical fields by distance L in a medium with % the refractive index n. try n; catch n=1.0; end try lambda; catch lambda = 1064e-9; end c=299792458; f0=c/lambda; fList = (f0+vMod)'; s=size(fDC); if numel(s) < 3 s(3)=1; end f = repmat(fList, [s(1),1,s(3)]); fDC2 = fDC .* exp(i*2*pi*n*L*f/c);