%PROGRAM TO FIND OUT ELECTRIC FIELD INTENSITY AT POINT 'P' %IN CARTESIAN COORDINATE SYSTEM %FOR A POINT CHARGE clear all; clc; epsilon_0 = input('Enter the value of free space permittivity = '); P = input('Enter the position of point P in cartesian coordinate system = '); Px = P(1); Py = P(2); Pz = P(3); Q = input('Enter the position of point Q in cartesian coordinate system = '); Qx = Q(1); Qy = Q(2); Qz = Q(3); q = input('Enter the value of point charge in coulombs = '); Rqpx = Px - Qx; Rqpy = Py - Qy; Rqpz = Pz - Qz; %Calculate vector distance between point P and Q Rqp = [Rqpx Rqpy Rqpz]; %Calculate scalar distance between point P and Q R = sqrt((Rqpx^2)+(Rqpy^2)+(Rqpz^2)); %Calculate Components of Electric Field Vector Ex = (q/(4*pi*epsilon_0*(R^3)))*Rqpx; Ey = (q/(4*pi*epsilon_0*(R^3)))*Rqpy; Ez = (q/(4*pi*epsilon_0*(R^3)))*Rqpz; UnitVector_X_direction ='ax'; UnitVector_Y_direction ='ay'; UnitVector_Z_direction ='az'; disp('Electric Field Intensity due to Point Charge = '); E = [Ex Ey Ez]