Tag Archive | MOT

MATLAB Code for MOT Lifetime – Linear Fitting

% #1 read .cvs file
C=uiimport(‘FileFolder\C2mot-gradient200032.txt’);

x=1:length(C.data(:,1));
plot(x,C.data(:,2));

% #2 find I_max
B=C.data(14000:17000,2);
I_max=mean(B);

w=log(I_max-C.data(:,2));

% #5 linear fit =>> slope is -1/tau =>> This is the first return value of
%polyfit
p_flu=polyfit(C.data(7200:10000,1),w(7200:10000),1);
tau=-1/p_flu(1)

MLoad= I_max-(exp(p_flu(2)).*(exp(-C.data(:,1)/tau)));
plot(x(5000:25000),C.data(5000:25000,2),x(5000:25000),MLoad(5000:25000))

Advertisements

MATLAB Code for Area Fit

%% Cloud area and Volume

% Imaging parameters
Magn=1; %magnification of the imaging system
px_sizew=3.75*10^(-3); %width of CCD pixel-in mm
px_sizeh=3.75*10^(-3); %height of CCD pixel-in mm
px_area=px_sizew*px_sizeh; %area for each pixel in mm^2

%% load image
C1=imread(‘C:\Users\Anarisil\Desktop\MOTPhase2\20120502\7-4\50ms.jpg’);

CAvrg=double(C1);

%% Dimension of the picture

[px_height,px_width]=size(CAvrg);
x=1:px_width;
y=1:px_height;

%% finding the maximum value of that point and the 1/e value
MaxInt=max(max(CAvrg));
threshold=MaxInt/exp(1);

%% %% counting
px_count=0;

for i=1:px_height
for j=1:px_width
if CAvrg(i,j)>=threshold
px_count=px_count+1;
else
end
end
end

%px_count will give the number of pixels with values above the threshold

%% determining the volume
%assumption: x=y=z
V(1,1)=px_count*px_area;
V(2,1)=4/(3*sqrt(pi))*(V(1,1))^(3/2); %in mm^3