diff options
Diffstat (limited to 'transverse/fitgaussianbeamrad.m')
-rw-r--r-- | transverse/fitgaussianbeamrad.m | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/transverse/fitgaussianbeamrad.m b/transverse/fitgaussianbeamrad.m new file mode 100644 index 0000000..65e3cdb --- /dev/null +++ b/transverse/fitgaussianbeamrad.m @@ -0,0 +1,19 @@ +% Fits beamwidth versus position data to a Gaussian beam profile
+function f=fitgaussianbeamrad(z,w,lambda,varargin)
+
+if nargin>3, startparams=varargin{1};
+else
+ w0=1e-3;
+ z0=0;
+ startparams=[w0,z0];
+end
+if nargin>4, displayoptions=varargin{2}; else displayoptions=[1 0 0]; end
+
+f=genfit(z,w,startparams,@beamrad,'nonlin',displayoptions);
+
+
+function w=beamrad(params,z)
+w=beamradius([params,lambda],z); % Want 1/e^2 Power radius
+end
+
+end
\ No newline at end of file |