Please provide code AND plots for questions a through f. Use MATLAB (you can use
ID: 2080273 • Letter: P
Question
Please provide code AND plots for questions a through f.
Use MATLAB (you can use meshgrid and quiver) and plot the Electric field of a) One positive charge 10C at the origin. b) One negative charge -10C at the origin. d) Two positive 1C charges located at (0.6, 0.6, 0) and (1.6, 1.6, 0). e) Two negative charges -1C located at (0.6, 0.6, 0) and -1C at (1.6, 1.6, 0). f) Negative charge -1C at (0.6, 0.6, 0) and positive 1C at (1.6, 1.6, 0). You can use following code or can write your own code. [x, y] = meshgrid(-3:.2:3, -3:.2:3); quiver (x, y, 10*x./(( squareroot (x.^2+y.^2).^3), 10*y./( squareroot (x.^2+y.^2).^3), 0.5) title('one positive charge')Explanation / Answer
clc;
close all;
clear all;
%QUESTION a)
Epsilon0 = 8.85E-12;
Q = 10;
figure (1);
[x,y] = meshgrid(-3:.2:3,-3:.2:3);
quiver(x,y,Q*(1/(4*pi*Epsilon0))*x./((sqrt(x.^2 + y.^2)).^3),10*(1/(4*pi*Epsilon0))*y./((sqrt(x.^2 + y.^2)).^3),0.5);
title('One positive charge');
%QUESTION b)
Epsilon0 = 8.85E-12;
Q = 10;
figure (2);
[x,y] = meshgrid(-3:.2:3,-3:.2:3);
quiver(x,y,-Q*(1/(4*pi*Epsilon0))*x./((sqrt(x.^2 + y.^2)).^3),10*(1/(4*pi*Epsilon0))*y./((sqrt(x.^2 + y.^2)).^3),0.5);
title('One negative charge');
%QUESTION c) The positive charges repel each other
Epsilon0 = 8.85E-12;
Q = 1;
figure (3);
[x,y] = meshgrid(-3:.2:3,-3:.2:3);
quiver(x,y,Q*[1*(1/(4*pi*Epsilon0))*(x-0.6)./((sqrt((x-0.6).^2 + (y-0.6).^2)).^3) - 1*(1/(4*pi*Epsilon0))*(x-1.6)./((sqrt((x-1.6).^2 + (y-1.6).^2)).^3)],[1*(1/(4*pi*Epsilon0))*(y-0.6)./((sqrt((x-0.6).^2 + (y-0.6).^2)).^3) - 1*(1/(4*pi*Epsilon0))*(y-1.6)./((sqrt((x-1.6).^2 + (y-1.6).^2)).^3)],0.5);
title('Two positive charges');
%QUESTION d) The negative charges repel each other
Epsilon0 = 8.85E-12;
Q = 1;
figure (4);
[x,y] = meshgrid(-3:.2:3,-3:.2:3);
quiver(x,y,Q*[1*(1/(4*pi*Epsilon0))*(x-0.6)./((sqrt((x-0.6).^2 + (y-0.6).^2)).^3) - 1*(1/(4*pi*Epsilon0))*(x-1.6)./((sqrt((x-1.6).^2 + (y-1.6).^2)).^3)],[1*(1/(4*pi*Epsilon0))*(y-0.6)./((sqrt((x-0.6).^2 + (y-0.6).^2)).^3) - 1*(1/(4*pi*Epsilon0))*(y-1.6)./((sqrt((x-1.6).^2 + (y-1.6).^2)).^3)],0.5);
title('Two negative charges');
%QUESTION d) The positive and negative charges attract each other
Epsilon0 = 8.85E-12;
Q = 1;
figure (5);
[x,y] = meshgrid(-3:.2:3,-3:.2:3);
quiver(x,y,Q*[-1*(1/(4*pi*Epsilon0))*(x-0.6)./((sqrt((x-0.6).^2 + (y-0.6).^2)).^3) + 1*(1/(4*pi*Epsilon0))*(x-1.6)./((sqrt((x-1.6).^2 + (y-1.6).^2)).^3)],[-1*(1/(4*pi*Epsilon0))*(y-0.6)./((sqrt((x-0.6).^2 + (y-0.6).^2)).^3) + 1*(1/(4*pi*Epsilon0))*(y-1.6)./((sqrt((x-1.6).^2 + (y-1.6).^2)).^3)],0.5);
title('One positive and negative charge');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.