Elect_field.m - clc clear Q1=8e-9 Q2=8e-9 pL=2e-9 Epsilono=8.8459e-12 P=[2 3 4 A=[0 0 1 B=[0 0-1 C=[2 0 0 charge Number_of_L_Steps=100000%charges

Elect_field.m - clc clear Q1=8e-9 Q2=8e-9 pL=2e-9...

This preview shows page 1 out of 1 page.

clc; clear; Q1=8e-9; %charges Q1 Q2=8e-9; %charges Q2 pL=2e-9; %charge density of the line Epsilono=8.8459e-12; %Permitivity of free space P=[2 3 4]; %coordinates of observation point A=[0 0 1]; %coordinates of Q1 B=[0 0 -1]; %coordinates of Q2 C=[2 0 0]; %coordinates of the center of the line charge Number_of_L_Steps=100000; %L is divided into 100000 segments %%the following routine calculates the electric fields at the observation point generated by the point charges R1=P-A; %the vector pointing from Q1 to the observation point R2=P-B; %the vector pointing from Q2 to the observation point R1Mag=norm(R1); %the magnitude of R1 R2Mag=norm(R2); %the magnitude of R1 E1=Q1/(4*pi*Epsilono*R1Mag^3)*R1; %the electric field generated by Q1 E2=Q2/(4*pi*Epsilono*R2Mag^3)*R2; %the electric field generated by Q2 %the following routine calculates the electric field at the observation point
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture