Commit 54f25c35 by Niklas Wahl

### Alle Skripte hinzugefügt

parent b1d317a7
 %% Aufgabe 1 %% Gegeben: %% clear all; d = 1 %m, Ladungsabstand q_1 = 1 %C q_2 = -3.5 * q_1 q = [q_1 q_2]; %Bentigt e_0 = 8.854e-12; %C^2/(N m^2) %% a) %% F = q_1 * q_2 / (4*pi*e_0*d^2) x = -1.5:0.2:2.5; y = -2:0.2:2; [X,Y] = meshgrid(x,y); q_1_pos = [0 0]; q_2_pos = q_1_pos + [d 0]; [q_1_theta, q_1_rho] = cart2pol(X - q_1_pos(1),Y - q_1_pos(2)); [q_2_theta, q_2_rho] = cart2pol(X - q_2_pos(1),Y - q_2_pos(2)); q_1_pot = q_1 ./ (4*pi*e_0*q_1_rho); q_2_pot = q_2 ./ (4*pi*e_0*q_2_rho); E_1 = q_1_pot ./ q_1_rho; E_2 = q_2_pot ./ q_2_rho; E_1_x = E_1 .* cos(q_1_theta); E_2_x = E_2 .* cos(q_2_theta); E_1_y = E_1 .* sin(q_1_theta); E_2_y = E_2 .* sin(q_2_theta); Ex = E_1_x + E_2_x; Ey = E_1_y + E_2_y; E_tot = sqrt(Ex.^2 + Ey.^2); tot_pot = q_1_pot + q_2_pot; contourf(X,Y, tot_pot); colormap hot; colorbar; hold on; streamslice(X,Y,Ex,Ey); plot([q_1_pos(1),q_2_pos(1)],[q_1_pos(2),q_2_pos(2)],'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b') %% \ No newline at end of file
 %% Elektrostatik - Aufgabe 2 %% Gegebene Gren: Ladungen & Punkt clear all; q(1).c = 25e-9; %Coulomb q(1).pos = 0.01*[0 4]; %cm q(2).c = 0.1e-6; q(2).pos = 0.01*[0 0]; q(3).c = -50e-9; q(3).pos = 0.01*[-4 3]; e_0 = 8.854e-12; %C^2/(N m^2) P = 0.01*[0 3]; windowMin = min([q(:).pos P]); windowMax = max([q(:).pos P]); % Plot pos = vertcat(q(:).pos)'; plot(pos(1,:),pos(2,:),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b'); box off; grid on; hold on; plot(P(1),P(2),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','k'); hold off; xlim([windowMin windowMax]); ylim([windowMin windowMax]); %% Teil a) %% Krfte %% r_12 = norm(q(1).pos - q(2).pos) F_12 = q(1).c*q(2).c / (4*pi*e_0*r_12^2) r_23 = norm(q(3).pos - q(2).pos) F_23 = q(3).c*q(2).c / (4*pi*e_0*r_23^2) winkel_12 = rad2deg(cart2pol(q(1).pos(1) - q(2).pos(1),q(1).pos(2) - q(2).pos(2))) winkel_23 = rad2deg(cart2pol(q(3).pos(1) - q(2).pos(1),q(3).pos(2) - q(2).pos(2))) %Winkel aus aufgabe alpha_23 = 180 - winkel_23; alpha_12 = 180 - winkel_12; %Negativ auf der y-Achse! F_23_buch = [F_23 * cosd(alpha_23) -F_23 * sind(alpha_23)] F_12_buch = [F_12 * cosd(alpha_12) -F_12 * sind(alpha_12)] %Da der koordinatenursprung in der ausgesetzten ladung lag, vorzeichen umdrehen! F_12 = -1 * [F_12 * cosd(winkel_12) F_12 * sind(winkel_12)] F_23 = -1 * [F_23 * cosd(winkel_23) F_23 * sind(winkel_23)] F_res = F_12 + F_23 %% %% Teil b) %% Berechne die Abstnde %% [X,Y] = meshgrid(linspace(windowMin,windowMax,20)); for i = 1:numel(q) %Polarkoordinaten (allgemein) [q(i).winkel, q(i).rAll] = cart2pol(X-q(i).pos(1),Y - q(i).pos(2)); %Aufgabenspezifisch [q(i).winkel_p, q(i).r_p] = cart2pol(P(1) - q(i).pos(1), P(2) - q(i).pos(2)); q(i).dist = P - q(i).pos; %q(i).r = norm(q(i).dist); fprintf('rp_%d = %f\n',i,q(i).r_p); end E_feld = @(q,r) q ./ (4*pi*e_0*r.^2); %% Beitrge der E-Felder %% %E-Felder Betrge for i = 1:numel(q) q(i).E = E_feld(q(i).c,q(i).r_p); fprintf('E_%d = %g\n',i, q(i).E); q(i).EAll = E_feld(q(i).c,q(i).r_p); end %% Feldvektoren %% E_feldvec_x = @(E,winkel) E .* cos(winkel); E_feldvec_y = @(E,winkel) E .* sin(winkel); ExAll = zeros(size(X)); EyAll = zeros(size(Y)); %Feldkomponenten for i = 1:numel(q) q(i).E_vec(1) = E_feldvec_x(q(i).E,q(i).winkel_p); q(i).E_vec(2) = E_feldvec_y(q(i).E,q(i).winkel_p); disp(q(i).E_vec) q(i).Ex_All = E_feldvec_x(q(i).EAll,q(i).winkel); q(i).Ey_All = E_feldvec_y(q(i).EAll,q(i).winkel); ExAll = ExAll + q(i).Ex_All; EyAll = EyAll + q(i).Ey_All; %quiver(X,Y,q(i).Ex_All,q(i).Ey_All); end %% Superposition und Endergebnis %% EP_All = vertcat(q(:).E_vec); EP_Sup = sum(EP_All,1) EP = norm(EP_Sup) EAll = sqrt(ExAll.^2 + EyAll.^2); contourf(X,Y,EAll); hold on; colormap copper; colorbar; quiver(X,Y,ExAll,EyAll); plot(pos(1,:),pos(2,:),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b'); box off; grid on; hold on; plot(P(1),P(2),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','k'); xlim([windowMin windowMax]); ylim([windowMin windowMax]); \ No newline at end of file
 %% Elektrostatik - Aufgabe 3 %% Gegeben: %% clear all; e = 1.609e-19; %C m_e = 9.11e-31; %kg d = 0.01; %1cm durchlauf durch plattenkondensator U_B = 1e3; %1kV s = 0.002; %0,2 cm Plattenastand %% Eintrittsgeschwindigkeit %% v_0 = sqrt(2*e*U_B / m_e) %% Zeit %% t = d / v_0 %% Ablenkung %% U = m_e * s^2 * v_0^2 / e / d^2 \ No newline at end of file
 %% Elektrostatik - Aufgabe 4 %% Gegeben: %% clear all; d = 5; %m E = 1000; %V/m %% Flche %% A = (d/2)^2 * pi %% Fluss %% Phi_el = E*A %% \ No newline at end of file
 %% Elektrostatik - Aufgabe 5 %% Gegeben: %% clear all; r1 = 1e-3; %1mm r2 = 1; %1m q1 = 5e-12; %5 pC q2 = 0.02e-9; %0.02 nC r3 = 0.1; %Zustzliche Kosntanten e_0 = 8.854e-12; %C^2 / (N m^2) %% Potentiale %% phi = @(q,r) q ./ (4*pi*e_0*r); phi1 = phi(q1,r1) phi2 = phi(q1,r2) %% Spannung %% U = phi1 - phi2 %% Energie %% W1 = q1 * U %% Arbeit an Probeladung q2 %% W2 = q2 * phi(q1,r3) \ No newline at end of file
 %% Elektrostatik - Aufgabe 6 %% Gegebene Gren: Ladungen & Punkt clear all; q(1).c = 10e-9; %Coulomb q(1).pos = 0.001*[0 2]; %cm q(2).c = -4e-9; %C q(2).pos = 0.001*[2 0]; q(3).c = -2.5e-9; q(3).pos = 0.001*[4 2]; e_0 = 8.854e-12; %C^2/(N m^2) P = 0.001*[2 4]; windowMin = min([q(:).pos P]); windowMax = max([q(:).pos P]); % Plot pos = vertcat(q(:).pos)'; plot(pos(1,:),pos(2,:),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b'); box off; grid on; hold on; plot(P(1),P(2),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','k'); hold off; %% Potentiale %% [X,Y] = meshgrid(linspace(windowMin,windowMax,20)); phi = @(q,r) q ./ (4*pi*e_0*r); phiAll = zeros(size(X)); for i = 1:numel(q) %Polarkoordinaten (allgemein) [q(i).winkel, q(i).rAll] = cart2pol(X-q(i).pos(1),Y - q(i).pos(2)); q(i).phiAll = phi(q(i).c,q(i).rAll); phiAll = phiAll + q(i).phiAll; %Aufgabenspezifisch q(i).dist = P - q(i).pos; q(i).r = norm(q(i).dist); fprintf('rp_%d = %f\n',i,q(i).r); q(i).phi = phi(q(i).c,q(i).r); fprintf('phi_%d = %f\n',i,q(i).phi); end %% Superposition und Endergebnis %% phi_P = sum([q(:).phi]) contourf(X,Y,phiAll); hold on; colormap copper; colorbar; plot(pos(1,:),pos(2,:),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b'); box off; grid on; hold on; plot(P(1),P(2),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','k'); \ No newline at end of file
 %% Elektrostatik - Aufgabe 7 %% Gegeben: %% clear all; s = 0.05; d = 0.001; U = 12; e_r = 2; %Zustzliche Kosntanten e_0 = 8.854e-12; %C^2 / (N m^2) %% Teil a) %% Kapazitt %% C = @(e_r,A,d) e_0*e_r*A/d; C_a = C(e_r,s^2,d) %% Ladung %% Q = C_a * U %% Teil b) %% Kapazitten %% C_1 = C(e_r, s^2, d/2) C_2 = C(1,s^2,d/2) %% Gesamtkapazitte (Reihenschaltung) C_ers = C_1*C_2 / (C_1 + C_2) %% Ladung %% Q = C_ers * U \ No newline at end of file
 %% Elektrostatik - Aufgabe 8 %% Gegeben: %% clear all; U = 8 C1 = 5e-12 C2 = 3 * C1 C3 = 0.01e-9 C5 = 1e-12 C4 = 0.5*C5 C6 = 0.5*C1 %% Kapazitten %% C_Reihe = @(Cs) 1 / sum(1./Cs); C_Parallel = @(Cs) sum(Cs); Cers12 = C_Reihe([C1,C2]) Cers123 = C_Parallel([Cers12,C3]) Cers456 = C_Reihe([C4 C5 C6]) Cges = C_Reihe([Cers123 Cers456]) %% Ladungen %% Qges = Cges * U U4 = Qges / C4 U5 = Qges / C5 U6 = Qges / C6 U3 = Qges / Cers123 Q3 = U3 * C3 Q1 = U3*Cers12 Q2 = Q1 \ No newline at end of file
 %% Wie rechne ich.. die berlagerung elektrischer Felder aus? %% Ladungen & Punkt %% clear all; q(1).c = 1; %Coulomb q(1).pos = [0 0]; %cm q(2).c = 3; q(2).pos = [4 2]; q(3).c = -2; q(3).pos = [3 4]; P = [0 4]; % Plot windowMin = min([q(:).pos P]) - 1; windowMax = max([q(:).pos P]) + 1; pos = vertcat(q(:).pos)'; plot(pos(1,:),pos(2,:),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b'); box off; grid on; hold on; plot(P(1),P(2),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','k'); xlim([windowMin windowMax]); ylim([windowMin windowMax]); %% Berechne die Abstnde %% [X,Y] = meshgrid(linspace(windowMin,windowMax,100)); %Abstnde for i = 1:numel(q) q(i).dist = P - q(i).pos; q(i).r = norm(q(i).dist); fprintf('r_%d = %f\n',i,q(i).r); q(i).rAll = arrayfun(@(x,y) norm([x y] - q(i).pos),X,Y); end e_0 = 8.854e-12; %C^2/(N m^2) E_feld = @(q,r) q ./ (4*pi*e_0*r.^2); %% Beitrge der E-Felder %% %E-Felder Betrge for i = 1:numel(q) q(i).E = E_feld(q(i).c,q(i).r * 0.01); %r in m! fprintf('E_%d = %g\n',i, q(i).E); q(i).EAll = E_feld(q(i).c,q(i).r * 0.01); end %% Berechnung der Winkel (-> Polarkoordinaten) %% %Winkel for i = 1:numel(q) q(i).winkel = arrayfun(@(x,y) cart2pol(x-q(i).pos(1),y - q(i).pos(2)),X,Y); %p_cos = [P(1) - q(i).pos(1)] / q(i).r; p_sin = [P(2) - q(i).pos(2)] / q(i).r; q(i).p_alpha = asind(p_sin); q(i).p_polar = cart2pol(P(1)-q(i).pos(1),P(2) - q(i).pos(2)); fprintf('alpha_%d = %f\n',i,q(i).p_alpha); end %% Feldvektoren %% E_feldvec_x = @(E,winkel) E .* cos(winkel); E_feldvec_y = @(E,winkel) E .* sin(winkel); ExAll = zeros(size(X)); EyAll = zeros(size(Y)); %Feldkomponenten for i = 1:numel(q) q(i).E_vec(1) = E_feldvec_x(q(i).E,q(i).p_polar); q(i).E_vec(2) = E_feldvec_y(q(i).E,q(i).p_polar); disp(q(i).E_vec) q(i).Ex_All = E_feldvec_x(q(i).EAll,q(i).winkel); q(i).Ey_All = E_feldvec_y(q(i).EAll,q(i).winkel); ExAll = ExAll + q(i).Ex_All; EyAll = EyAll + q(i).Ey_All; %quiver(X,Y,q(i).Ex_All,q(i).Ey_All); end %% Superposition und Endergebnis %% EP_All = vertcat(q(:).E_vec); EP_Sup = sum(EP_All,1); disp(EP_Sup); EP = norm(EP_Sup); disp(EP); EAll = sqrt(ExAll.^2 + EyAll.^2); contourf(X,Y,EAll); colormap pink; colorbar; %quiver(X,Y,ExAll,EyAll); hold off; streamslice(X,Y,ExAll,EyAll); hold on; plot(pos(1,:),pos(2,:),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','b'); box off; grid on; plot(P(1),P(2),'LineStyle','None','Marker','o','MarkerSize',10,'MarkerFaceColor','k'); xlim([windowMin windowMax]); ylim([windowMin windowMax]); \ No newline at end of file
 %% Wie rechne ich.. Elektronenvolt in Joule um? %% Gegeben: %% clear all; eV = 3 J = 5.8e-10 e = 1.609e-19; %C %% Ergebnis %% eV2J = 3 * e J2eV = J / e \ No newline at end of file
 %% Wie rechne ich.. die Elektronenablenkung in einer Braun'schen Rhre? %% Gegeben: %% clear all; x = 0.01; %1cm v_x = 9e6; %m/s E_y = 1000; %N/C; q = 1.609e-19; %C m_e = 9.11e-31; %kg g = 9.81; %m/s d = 0.2; %20cm %% Zeit %% t = x ./ v_x %% Spielt die Gravitationskraft eine Rolle? %% F_el = q * E_y; F_G = m_e * g; verhaeltnis = F_el / F_G %% Ablenkung %% %F == F_el a = q*E_y / m_e y_1 = 0.5*a*t^2 v_y = a * t alpha = atand(v_y / v_x)