Refactoring
This commit is contained in:
70
Matlab/axial.asv
Normal file
70
Matlab/axial.asv
Normal file
@@ -0,0 +1,70 @@
|
||||
clear
|
||||
close all
|
||||
clc
|
||||
format compact
|
||||
|
||||
% These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
% gradient laser trap on a dielectric sphere in the ray optics regime".
|
||||
% There are axial forces only
|
||||
|
||||
load_constants
|
||||
|
||||
% Factors plots
|
||||
|
||||
theta = linspace(0, pi/2, 500);
|
||||
figure
|
||||
plot(theta, qs_factor(theta, pi/4, n1, n2), ...
|
||||
theta, -qg_factor(theta, pi/4, n1, n2), ...
|
||||
theta, qmag_factor(theta, pi/4, n1, n2))
|
||||
grid
|
||||
xlabel('$\theta$, $^{\circ}$', 'Interpreter', 'latex')
|
||||
ylabel('Q')
|
||||
|
||||
% Intensity profile plots
|
||||
rho = linspace(-r_max, r_max, 500);
|
||||
figure
|
||||
I = gauss(rho, r_max, w0, P);
|
||||
I0 = max(I);
|
||||
plot(rho, I/I0, 'k')
|
||||
grid
|
||||
xlabel('r, м')
|
||||
ylabel('I(r)')
|
||||
|
||||
% Integration
|
||||
G0 = gauss_peak(r_max, w0, P);
|
||||
Qres_g = @(z) 2 * pi * G0 * integral2(@(beta, r) r .* gauss(r, r_max, w0, P) .* ...
|
||||
iscomplex(qg_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
|
||||
'Method', 'iterated', 'AbsTol', 1e-6, 'RelTol', 1e-6);
|
||||
|
||||
Qres_s = @(z) 1 / (pi * r_max^2) * integral2(@(beta, r) r .* gauss(r, r_max, w0, P) .* ...
|
||||
iscomplex(qs_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
|
||||
'Method', 'iterated', 'AbsTol', 1e-6, 'RelTol', 1e-6);
|
||||
|
||||
% Calulation
|
||||
N = 200;
|
||||
z = linspace(-2*Rsp, 2*Rsp, N);
|
||||
Axial_g = zeros(1, N);
|
||||
Axial_s = zeros(1, N);
|
||||
|
||||
wb = waitbar(0, 'Calculating...');
|
||||
for ii = 1:N
|
||||
Axial_g(ii) = Qres_g(z(ii));
|
||||
Axial_s(ii) = Qres_s(z(ii));
|
||||
waitbar(ii / N, wb, 'Calculating...');
|
||||
end
|
||||
close(wb);
|
||||
|
||||
Axial_g = fliplr(Axial_g);
|
||||
Axial_s = fliplr(Axial_s);
|
||||
Axial = Axial_g + Axial_s;
|
||||
z = -fliplr(z);
|
||||
|
||||
% Plots
|
||||
figure
|
||||
plot(z, F0 * Axial_g, 'b-.', ...
|
||||
z, F0 * Axial_s, 'r--', ...
|
||||
z, F0 * Axial, 'k')
|
||||
legend('F_{g}','F_{s}','F_{t}')
|
||||
xlabel('r, м')
|
||||
ylabel('F, Н')
|
||||
grid
|
||||
Reference in New Issue
Block a user