%PROGRAM TO FIND OUT ELECTRIC FIELD INTENSITY AT POINT 'P'DUE TO
%INFINITE LINE CHARGE
clear all;
clc;
P = input('Enter the position of point P in rectangualr coordinate system = ');
Q = input('Enter the position of point Q in rectangular coordinate system = ');
P_L = input('Enter the value of Line charge density in coulombs/meter = ');
epsilon_0 = input('Enter the value of free space permittivity = ');
Rx = P(1)- Q(1);
Ry = P(2)- Q(2);
Rz = P(3)- Q(3);
Rqp = sqrt((Rx^2)+(Ry^2)+(Rz^2));
Ex = (P_L/(2*pi*epsilon_0*(Rqp^2)))*Rx;
Ey = (P_L/(2*pi*epsilon_0*(Rqp^2)))*Ry;
Ez = (P_L/(2*pi*epsilon_0*(Rqp^2)))*Rz;
disp('Electric Field Intensity due to Infinite Line Charge = ');
E = [Ex Ey Ez]