Effacer les filtres
Effacer les filtres

Hi, check this question

4 vues (au cours des 30 derniers jours)
Sai Hitesh Gorantla
Sai Hitesh Gorantla le 11 Jan 2020
Commenté : Steven Lord le 11 Jan 2020
Two 1 nC point positive charges are located at (-1, 0, 0) m and (1, 0, 0) m respectively. Write a MATLAB script to plot the magnitude of the electric field vector on the X axis between (-0.9, 0, 0) m and (0.9, 0, 0) m. Use the ‘plot’ command in MATLAB and use a spacing of 0.1 m between points along the X axis (Hint: x = -0.9:0.1:0.9). Ensure that you label the axes with appropriate units
  2 commentaires
Walter Roberson
Walter Roberson le 11 Jan 2020
I checked but I do not see any question there?
Steven Lord
Steven Lord le 11 Jan 2020
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Connectez-vous pour commenter.

Réponses (1)

Meg Noah
Meg Noah le 11 Jan 2020
Two Charges
% Two 1 nC point positive charges are located at (-1, 0, 0) m and (1, 0, 0) m respectively.
% Write a MATLAB script to plot the magnitude of the electric field vector
% on the X axis between (-0.9, 0, 0) m and (0.9, 0, 0) m.
% Use the ‘plot’ command in MATLAB and use a spacing of 0.1 m between
% points along the X axis (Hint: x = -0.9:0.1:0.9).
% Ensure that you label the axes with appropriate units
ke = 8.9875e9; % N·m2/C2 Coulomb's constant
% list of particle charge values
q = [1e-9;1e-9]; % [C]
% list of particle positions
p = [-1;1]; % [m]
x = -0.9:0.1:0.9; % [m]
E = zeros(size(x)); % [V/m]
% by superposition - add all the fields from all the charges
ncharges = length(q);
for icharge = 1:ncharges
R = x - p(icharge,:);
E = E + ke*q(icharge).*R./abs(R).^3;
end
figure();
plot(x,abs(E)); hold on;
plot(p(1),0,'*r');
plot(p(2),0,'*r');
box on; grid on;
ylabel('|E| [V/m]');
xlabel('X Position [m]');
twoCharges.png
A neutron walks into a bar, and asks the bartender how much it costs to get a beer. The bartender says for you, no charge!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by