Hi, check this question

조회 수: 1 (최근 30일)
Sai Hitesh Gorantla
Sai Hitesh Gorantla 2020년 1월 11일
댓글: Steven Lord 2020년 1월 11일
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
Walter Roberson
Walter Roberson 2020년 1월 11일
I checked but I do not see any question there?
Steven Lord
Steven Lord 2020년 1월 11일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Meg Noah
Meg Noah 2020년 1월 11일
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!

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by