summaryrefslogtreecommitdiff
path: root/transverse/fitgaussianbeamrad.m
blob: 65e3cdba58973a50f4b158698418cc3c8bb8d68a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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