Fixed matlab calculations

This commit is contained in:
2023-03-22 14:13:17 +04:00
parent 78916d0ec9
commit bd8cd9e635
6 changed files with 13 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ load_constants
% Intensity profile plots % Intensity profile plots
rho = linspace(-r_max, r_max, 500); rho = linspace(-r_max, r_max, 500);
figure figure
I = gauss(rho, r_max, w0); I = gauss(rho, w0, r_max);
I0 = max(I); I0 = max(I);
plot(rho, I/I0, 'k') plot(rho, I/I0, 'k')
grid grid
@@ -20,12 +20,11 @@ xlabel('r, м')
ylabel('I(r)') ylabel('I(r)')
% Integration % Integration
G0 = gauss_peak(r_max, w0); Qres_g = @(z) 1 / (pi * w0 ^ 2) * integral2(@(beta, r) r .* gauss(r, w0, r_max) .* ...
Qres_g = @(z) 2 * pi * G0 * integral2(@(beta, r) r .* gauss(r, r_max, w0) .* ...
iscomplex(qg_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ... iscomplex(qg_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
'Method', 'iterated', 'AbsTol', 1e-12, 'RelTol', 1e-6); 'Method', 'iterated', 'AbsTol', 1e-12, 'RelTol', 1e-6);
Qres_s = @(z) 2 * pi * G0 * integral2(@(beta, r) r .* gauss(r, r_max, w0) .* ... Qres_s = @(z) 1 / (pi * w0 ^ 2) * integral2(@(beta, r) r .* gauss(r, w0, r_max) .* ...
iscomplex(qs_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ... iscomplex(qs_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
'Method', 'iterated', 'AbsTol', 1e-12, 'RelTol', 1e-6); 'Method', 'iterated', 'AbsTol', 1e-12, 'RelTol', 1e-6);

View File

@@ -1,4 +1,6 @@
% Bessel beam % Bessel beam
function b = bessel(r, r_max, w0, P) function b = bessel(r, w0, r_max)
b = besselj(0, 2.405/w0 * r).^2; ring_radius = 2.405; % radisu of the first ring of the besselj_0
A = 2 * ring_radius / (w0 * r_max * exp(0.5)) * 2 * pi * integral(@(r) r.*besselj(0, ring_radius/w0 * r).^2, 0, r_max);
b = A * besselj(0, 2.405/w0 * r).^2;
end end

View File

@@ -1,3 +0,0 @@
function peak = bessel_peak(r_max, w0, P)
peak = P * 4.81 / (w0 * r_max * exp(0.5)) * 2 * pi * integral(@(r) r.*besselj(0, 2.405/w0 * r).^2, 0, r_max) / P0;
end

View File

@@ -1,4 +1,5 @@
% Gaussian TEM00 beam % Gaussian TEM00 beam
function g = gauss(r, r_max, w0) function g = gauss(r, w0, r_max)
g = exp(-2 * r.^2 / w0^2); A = (1 - exp(-2*r_max.^2 / w0^2)); % the fraction of power that falls on the pupil of the micro lens
g = 2 * A * exp(-2 * r.^2 / w0^2);
end end

View File

@@ -1,4 +0,0 @@
function peak = gauss_peak(r_max, w0)
A = (1 - exp(-2*r_max.^2 / w0^2));
peak = 2*A / (pi * w0^2);
end

View File

@@ -12,7 +12,7 @@ load_constants
% Intensity profile graphics % Intensity profile graphics
rho = linspace(-r_max, r_max, 500); rho = linspace(-r_max, r_max, 500);
I = gauss(rho, r_max, w0); I = gauss(rho, w0, r_max);
I0 = max(I); I0 = max(I);
figure figure
plot(rho, I/I0, 'k') plot(rho, I/I0, 'k')
@@ -21,12 +21,11 @@ xlabel('r, m')
ylabel('I(r)') ylabel('I(r)')
% Integration % Integration
G0 = gauss_peak(r_max, w0); Qres_g = @(y) 1 / (pi * w0^2) * integral2(@(beta, r) r .* gauss(r, w0, r_max) .* ...
Qres_g = @(y) G0 * integral2(@(beta, r) r .* gauss(r, r_max, w0) .* ...
iscomplex(qg_y_factor(beta, r, y, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ... iscomplex(qg_y_factor(beta, r, y, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
'Method', 'iterated', 'AbsTol', 1e-8, 'RelTol', 1e-6); 'Method', 'iterated', 'AbsTol', 1e-8, 'RelTol', 1e-6);
Qres_s = @(y) G0 * integral2(@(beta, r) r .* gauss(r, r_max, w0) .* ... Qres_s = @(y) 1 / (pi * w0^2) * integral2(@(beta, r) r .* gauss(r, w0, r_max) .* ...
iscomplex(qs_y_factor(beta, r, y, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ... iscomplex(qs_y_factor(beta, r, y, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
'Method', 'iterated', 'AbsTol', 1e-8, 'RelTol', 1e-6); 'Method', 'iterated', 'AbsTol', 1e-8, 'RelTol', 1e-6);