summaryrefslogtreecommitdiff
path: root/axial/w_.m
diff options
context:
space:
mode:
Diffstat (limited to 'axial/w_.m')
-rw-r--r--axial/w_.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/axial/w_.m b/axial/w_.m
new file mode 100644
index 0000000..6d4a2d4
--- /dev/null
+++ b/axial/w_.m
@@ -0,0 +1,23 @@
+%---------------------------------------------------------------
+% Returns the beam width given the q factor and wavelength
+% of a Gaussian beam. Note that q and lambda are assumed
+% to have the same units.
+%
+% SYNTAX: w=w_(q <,lambda>);
+%
+% q = q-factor of the beam at the position where R and w are to
+% be found. q can be a vector
+% lambda = wavelength. Can be a vector or scalar.
+%
+% If both q and lambda are vectors, they must be the same size.
+%
+%---------------------------------------------------------------
+% SYNTAX: w=w_(q <,lambda>);
+%---------------------------------------------------------------
+
+function wout=w_(q,varargin)
+
+if nargin>=2, lambda=varargin{1}; else lambda=1064e-9; end
+
+wout=sqrt(lambda/pi .* imag(q).*(1+real(q).^2./imag(q).^2));
+