summaryrefslogtreecommitdiff
path: root/src/abgabe.org
diff options
context:
space:
mode:
Diffstat (limited to 'src/abgabe.org')
-rw-r--r--src/abgabe.org101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/abgabe.org b/src/abgabe.org
new file mode 100644
index 0000000..772d04d
--- /dev/null
+++ b/src/abgabe.org
@@ -0,0 +1,101 @@
+#+TITLE: Übungsblatt 5 - Aufgabe 3
+#+HTML_HEAD_EXTRA: <meta name="robots" content="noindex">
+#+SETUPFILE: ../options.org
+
+[[https://thomaslabs.org/shortcoil.m][Quellcode herunterladen]]
+
+* Ergebnisse des Programms
+[[https://thomaslabs.org/media/betrag.png]]
+
+[[https://thomaslabs.org/media/richtung.png]]
+
+[[https://thomaslabs.org/media/spulenachse.png]]
+* Octave / Matlab Quellcode
+#+BEGIN_SRC octave
+ clear all;
+ close all;
+ clc;
+
+ %% length of the observed region in m
+ len = 40e-3; %m
+ len = len / 2; %we shall go from -len to +len
+ %% number of points in x- and z-direction
+ N_space = 50;
+ %% number of points for integration along coil
+ N_phi = 250;
+ %% radius
+ R = 5e-3; %m
+ %% length
+ L = 23e-3; %m
+ %% number of windings
+ N = 5;
+ %% current
+ I = 8; %A
+ %% vacuumpermeability
+ mu0 = 4 * pi * 1e-7; %Vs/Am
+
+ %% define grid
+ z = linspace(-len, len, N_space); %m
+ x = linspace(-len, len, N_space); %m
+
+ %% parameter of coil-wire-path-paramtrisation
+ phi = linspace(0, N * 2 * pi, N_phi);
+ dphi = phi(2) - phi(1);
+
+ %% Precalculate cos and sin
+ p_sin = sin(phi);
+ p_cos = cos(phi);
+
+ %% loop through all x-z-points
+ for iz = 1 : N_space
+ for ix = 1 : N_space
+ %% r of this x-z-point
+ r = [x(ix); 0; z(iz)];
+ B = [0; 0; 0];
+
+ %% Riemann sum along the coil
+ for ip = 1 : N_phi
+ %% Point along the coil
+ l = [R * p_cos(ip); R * p_sin(ip); ip * L / N_phi - L / 2];
+ %% Vector tangent to the coil of length dl = R * dphi
+ dl = [- R * p_sin(ip); R * p_cos(ip); L / 2 / N / pi];
+ dl = (R * dphi / norm(dl)) * dl;
+ %% Vector from the coil to the x-z-point
+ rp = r - l;
+ %% Add dB
+ B = B + (mu0 / 4 / pi) * I * (1 / norm(rp) ^ 3) * cross(dl, rp);
+ end
+
+ B_X(iz, ix) = B(1);
+ B_Y(iz, ix) = B(2);
+ B_Z(iz, ix) = B(3);
+ end
+ end
+
+ figure('Name', 'Richtung der Flußdichte', 'NumberTitle', 'off');
+ quiver(x * 1e3, z * 1e3, B_X ./ sqrt(B_X .^ 2 + B_Z .^ 2),
+ B_Z ./ sqrt(B_X .^ 2 + B_Z .^ 2));
+ title('Richtung der Flußdichte')
+ xlabel('x [mm]')
+ ylabel('z [mm]')
+ axis image
+ saveas(gca, 'richtung.png')
+
+ betrag = sqrt(B_X .^ 2 + B_Y .^ 2 + B_Z .^ 2)
+ figure('Name', 'Betrag der Flußdichte', 'NumberTitle', 'off');
+ imagesc(x * 1e3, z * 1e3, betrag);
+ title('Betrag der Flußdichte');
+ xlabel('x [mm]')
+ ylabel('z [mm]')
+ colormap(gray);
+ colorbar('title', 'B [T]');
+ saveas(gca, 'betrag.png')
+
+ figure('Name', 'Flußdichte entlang Spulenachse', 'NumberTitle', 'off');
+ B_2 = B_Z(:, round((N_space - 1) / 2));
+ plot(x * 1e3, B_2);
+ title('Flußdichte entlang Spulenachse');
+ xlabel('z [mm]');
+ ylabel('Flußdichte [T]');
+ saveas(gca, 'spulenachse.png')
+#+END_SRC