Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Two line charges with linear densities of 1.0 mu C/m and -1.0 mu C/m lie on the

ID: 2073140 • Letter: T

Question

Two line charges with linear densities of 1.0 mu C/m and -1.0 mu C/m lie on the xy-plane parallel to the x-axis as shown in Figure below. Write a MATLAB program to plot the electric flux lines in the region bounded by the dashed lines. Change the length of the linear charges to extend from -16 to 16 in the x-direction and plot the flux lines in the same region again. A linear charge rho L = 2.0 mu C/m lies on the yz-plane as shown in below. Find the electric flux passing through the plane extending from 0 to 1.0 m in the x-direction and from -infinity to infinity in the y-direction. Write a MATLAB program to verify your answer.

Explanation / Answer

(a)

clc;

clear;

min=-16;

max=16;

num=100;

step=(max-min)/(num-1);

[x,y]=meshgrid(-16;step16,-16;step:16); build arrays to plot the spaces

Fx=zeros(num,num); x-component of flux density

Fy=zero(num,num); y-component of flux density

PL1=1.0; top line charge density

PL2=-1.0; bottom line charge line density

for i=1;

for j=1;

%cos=x/h;

%sin=y/h;

x=x(i,j);

y=y(i,j);

Fy(i,j)=(PL1/(2*Pi*(y-1)))*1;

Fx(i,j)=(PL1/2*Pi*(y-1)))*0;

Fy(i,j)=Fy(i,j)+(PL2/(2*Pi*(y+1)))*1;

Fy(i,j)=Fy(i,j)+(PL2/(2*Pi*(y+1)))*0;

end;

end

quiver(x,y,Fx,Fy)

(b)

clc;

clear;

Q=1; point charge

y=(0 0 1); location of the point charge

az=(0 1 1); unit vector of z-direction

x_lower=-100;

x_upper=100;

y_lower=-100;

y_upper=100;

z_lower=-100;

z_upper=100;

number of x_steps=300;

number of y_steps=300;

number of z_steps=300;

dx=(x_upper-x_lower)/number of x_steps; increment of x

dy=(y_upper-y_lower)/number of y_steps; increment of y

dz=(z_upper-z_lower)/number of z_steps; increment of z

flux=0; intialization of flux

for j=1;

for j=1;

for k=1;

ds=dx*dy*dz;

x=x_lower+0.5*dx+(i-1)*dx;

y=y_lower+0.5*dy+(i-1)*dy;

z=z_lower+0.5*dz+(i-1)*dz;

P=(x y z);

R=P-C;

Rmage=norm(R);

R_HAt=R/Rmag;

R_surface=-az;

flux=flux+Q*ds*dot(R_surface,R_hat)/(4*pi*Rmag^2); get contribution to the flux

end

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote