summaryrefslogtreecommitdiff
path: root/axial/q_.m
blob: be678d4da4612a15c4cecd44b5b66d1acc6cd5f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%---------------------------------------------------------------
% Returns the q-factor of a Gaussian beam given the spot size,
% phasefront radius of curvature and wavelength.
%
% SYNTAX: qfactor=q_(w,R <,lambda>);
%
% w      = 1/e Field radius 
% R      = Radius of curvature of phasefront
% lambda = wavelength
%
% Any one of w, R and lambda may be a vectors or scalars.
% If more than one of w, R and lambda is a vector, all 
% vectors supplied must be the same size. w, R and lambda must
% all be in the same units.
%
%--------------------------------------------------------------
% SYNTAX: qfactor=q_(w,R <,lambda>);
%--------------------------------------------------------------

function qfactor=q_(w,R,varargin)

if nargin>=3, lambda=varargin{1}; else lambda=1064e-9; end


if R~=Inf
    qfactor=pi*w.^2.*R./(pi*w.^2-1i.*R.*lambda);
else
    qfactor=1i*pi*w.^2./lambda;
end