How to handle quiver3 vector scaling?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I display the magnitude of the arrows for the line charge without resorting to unit vectors? I think I understand that quiver3 scales the vectors based on the highest number, however I am unsure how to deal with the high numbers in a mesh grid. I do have isinf = nan code, just incase.
Context: plotting electric fields due to line charge
range = -2:0.1:2;
[x,y,z] = meshgrid (range,range,range);
q1 = 2E-6; % Test Charge Value
k = 9E9; % Permitivity
circx = -1:.001:0;
extot = zeros(1,1,1);
eytot = zeros(1,1,1);
eztot = zeros(1,1,1);
% Test Charge 1 at (1,0,0)
% ex = (k*q1 ./ ((x-1).^2 + y.^2 + z.^2).^(3/2)) .* (x-1);
% ey = (k*q1 ./ ((x-1).^2 + (y).^2 + z.^2).^(3/2)) .* y;
% ez = (k*q1 ./ ((x-1).^2 + y.^2 + (z).^2).^(3/2)) .* z;
%% Line Charge
for num = 1:length(circx)
extot = extot + (k*q1 ./ ((x-circx(1,num)).^2 + y.^2 + ((z-abs(sqrt(1-circx(1,num).^2))).^2)).^(3/2)) .* (x-circx(1,num));
eytot = eytot + (k*q1 ./ ((x-circx(1,num)).^2 + y.^2 + ((z-abs(sqrt(1-circx(1,num).^2))).^2)).^(3/2)) .* (y);
eztot = eztot + (k*q1 ./ ((x-circx(1,num)).^2 + y.^2 + ((z-abs(sqrt(1-circx(1,num).^2))).^2)).^(3/2)) .* (z-(sqrt(1-circx(1,num).^2)));
end
quiver3(x,y,z,extot,eytot,eztot)
view(0,0)
Vectors plotted as is:

Dividing by the magnitude:


However I want the intensity to be similar to the behavior of the vectors for the point charges:

3 commentaires
Daniel M
le 27 Oct 2019
Modifié(e) : Daniel M
le 27 Oct 2019
I haven't looked into whether you've implemented the code properly (if you post the equation we can check that). Just wanted to point out that the electric field from a point charge falls off as 1/r^2, whereas a line charge falls off linearly. So, you shouldn't "want" the vector magnitudes to be scaled similarly to the point charges because that is not how physics says it will behave.
P.s. I love the image of the point charges. It is so cool. You should try to plot the field lines of a magnetic dipole next.
Réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!