#1) Matlab Code: x=0:10; y=((x.*2)./((x.*2)+1)); plot(x,y) ylabel('E for the segment/E for the infinite line') xlabel('L/d') grid on title('The ratio of E for the segment to E for the infinite line is to be plotted versus the ratio L/d') Matlab Figure: #2) k=9e9; z; y; x; outcome=@(x,y,z)(20-z)./(((x.^2+y.^2+(20-z).^2).^(1./3))) outcome=@(x,y,z)(20-z)./(((x.^2+y.^2+(20-z).^2).^(1./3))) zmin=-6; xmin=0; ymin=0; zmax=0; xmax=4; ymax=5; solution=integral3(outcome,zmin,zmax,ymin,ymax,xmin,xmax) Solution=308.0769 N/C #3) #4) #5) #6) #7) #8) k=3e-3; rmax=9e-3; I=2; n=100; dr=rmax/n; for b=round(k/dr)+1:n r(b)=b*dr; H(b)=I/(2*pi*r(b)); end for b=1:round(k/dr) r(b)=b*dr; H(b)=(I/(2*pi*k^2))*r(b); end plot(r,H) ylabel('magnetic field intensity H(A/m)') xlabel(' radial distance from the z-axis over the range 0 ≤ p ≤ 9 mm(m)') grid on title('magnetic field intensity H versus radial distance from the z-axis over 9 mm ') the range 0 ≤ p ≤ TITLE:MAGNETIC FIELD INTENSITY H VERSUS RADIAL DISTANCE FROM THE ZAXIS OVER THE RANGE 0 ≤ P ≤ 9 mm #9) clc clearvars k=4e-2; I=10e-3; n=100; rmax=12e-2; dr=rmax/n; for a=1:round(k/dr) r(a)=a*dr; H(a)=0; end for a=round(k/dr)+1:n r(a)=a*dr; H(a)=100*I/(2*pi*r(a)); end plot(r,H) xlabel('p(cm)') ylabel('H (A/m)') title('H as a function of radial distance from the z-axis over the range 0 ≤p≤ 12 cm.') grid on #10) k=2e-2; rmax=9e-3; I=1; n=80; z=40; dr=rmax/n; for b=1:z r(b)=.1+(b-1)*dr; H(b)=100*I/(2*pi*r(b)); end for b=z:n r(b)=b*dr; H(b)=0; end plot(r,H) ylabel('magnetic field intensity H(A/m)') xlabel(' radial distance from the z-axis over the range 0 ≤ p ≤ 4 cm(m^-2)') grid on title('magnetic field intensity H versus radial distance from the z-axis over the range 0 ≤ p ≤ 4cm ') TITLE:MAGNETIC FIELD INTENSITY H VERSUS RADIAL DISTANCE FROM THE ZAXIS OVER THE RANGE 0 ≤ P ≤ 4CM