Hi, check this question
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Steven Lord
el 11 de En. de 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.
Respuestas (1)
Meg Noah
el 11 de En. de 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]');
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!
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!