Refactoring

This commit is contained in:
2023-03-20 22:50:56 +04:00
parent 8958bf5204
commit 74231472c9
32 changed files with 240 additions and 201 deletions

View File

@@ -8,13 +8,14 @@ format compact
% There are axial forces only
load_constants
import factors.*
% Factors plots
theta = linspace(0, pi/2, 500);
figure
plot(theta, Qs(theta, pi/4), theta, -Qg(theta, pi/4), theta, Qmag(theta, pi/4))
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')
@@ -22,26 +23,28 @@ ylabel('Q')
% Intensity profile plots
rho = linspace(-r_max, r_max, 500);
figure
plot(rho, I(rho)/max(I(rho)),'k')
I = gauss(rho, r_max, w0);
I0 = max(I);
plot(rho, I/I0, 'k')
grid
xlabel('r, м')
ylabel('I(r)')
% Integration
G0 = 2/(A*pi^2*r_max^2*w0^2);
Qres_g = @(z) G0 * integral2(@(beta,r) r.*I(r).*...
iscomplex(Qgz(r,z)),0,2*pi,0,r_max,...
'Method','iterated','AbsTol',1e-6,'RelTol',1e-6);
G0 = gauss_peak(r_max, w0);
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, ...
'Method', 'iterated', 'AbsTol', 1e-12, 'RelTol', 1e-6);
Qres_s = @(z) G0 * integral2(@(beta,r) r.*I(r).*...
iscomplex(Qsz(r,z)),0,2*pi,0,r_max,...
'Method','iterated','AbsTol',1e-6,'RelTol',1e-6);
Qres_s = @(z) 2 * pi * G0 * integral2(@(beta, r) r .* gauss(r, r_max, w0) .* ...
iscomplex(qs_z_factor(r, z, n1, n2, Rsp, f)), 0, 2*pi, 0, r_max, ...
'Method', 'iterated', 'AbsTol', 1e-12, 'RelTol', 1e-6);
% Calulation
N = 200;
z = linspace(-2*Rsp,2*Rsp,N);
Axial_g = zeros(1,N);
Axial_s = zeros(1,N);
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
@@ -58,7 +61,9 @@ z = -fliplr(z);
% Plots
figure
plot(z,F0*Axial_g,'b-.',z,F0*Axial_s,'r--',z,F0*Axial,'k')
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, Н')