summaryrefslogtreecommitdiff
path: root/axial/q_.m
diff options
context:
space:
mode:
Diffstat (limited to 'axial/q_.m')
-rw-r--r--axial/q_.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/axial/q_.m b/axial/q_.m
new file mode 100644
index 0000000..be678d4
--- /dev/null
+++ b/axial/q_.m
@@ -0,0 +1,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 \ No newline at end of file