Question

MATLAB CODE: The electric potential around a charged particle is given by , where ε=8.854x10-12?=14????C/Nm2 ,...

MATLAB CODE:

The electric potential around a charged particle is given by , where ε=8.854x10-12?=14????C/Nm2 , q is the charge and r is the distance from the particle. The electric potential of 2 particles at a point P is given by , where q1 and q2 are the particles charges and r1 and r2?=14??(?1?1+?2?2)are distances from the particles to P. Two particles with charges q1=2x10-10 C and q2=3x10-10 C are located in the x-y plane at (0.25,0) and (-.25,0). Calculate and plot the electric potential due to the particles at points in the x-y plane located in the domain -0.3<=x<=0.3 and -0.3<=y<=0.3.

Thank you :)

Homework Answers

Answer #1
       This simple program computes the Electric Fields due to dipole  
%           in a 2-D plane using the Coulomb's Law
%-------------------------------------------------------------------------%
clc
close all; clear all;
%-------------------------------------------------------------------------%
%                   SYMBOLS USED IN THIS CODE                             
%-------------------------------------------------------------------------%
% E = Total electric field
% Ex = X-Component of Electric-Field
% Ey = Y-Component of Electric-Field
% n = Number of charges
% Q = All the 'n' charges are stored here
% Nx = Number of grid points in X- direction
% Ny = Number of grid points in Y-Direction
% eps_r = Relative permittivity
% r = distance between a selected point and the location of charge
% ex = unit vector for x-component electric field
% ey = unit vector for y-component electric field
%-------------------------------------------------------------------------%
%-------------------------------------------------------------------------%
%                         INITIALIZATION                                  
%          Here, all the grid, size, charges, etc. are defined
%-------------------------------------------------------------------------%
% Constant 1/(4*pi*epsilon_0) = 9*10^9
k = 9*10^9;
% Enter the Relative permittivity
eps_r = 1;
charge_order = 10^-9; % milli, micro, nano etc..
const = k*charge_order/eps_r;
% Enter the dimensions
Nx = 101; % For 1 meter
Ny = 101; % For 1 meter
% Enter the number of charges.
n = 2;
% Electric fields Initialization
E_f = zeros(Nx,Ny);
Ex = E_f;
Ey = E_f;
% Vectors initialization
ex = E_f;
ey = E_f;
r = E_f;
r_square = E_f;
% Array of charges
Q = [1,-1];
% Array of locations
X = [5,-5];
Y = [0,0];
%-------------------------------------------------------------------------%
%                   COMPUTATION OF ELECTRIC FIELDS
%-------------------------------------------------------------------------%
%  Repeat for all the 'n' charges
for k = 1:n
    q = Q(k);
    
    % Compute the unit vectors
    for i=1:Nx
        for j=1:Ny
            r_square(i,j) = (i-51-X(k))^2+(j-51-Y(k))^2;
            r(i,j) = sqrt(r_square(i,j));
            ex(i,j) = ex(i,j)+(i-51-X(k))./r(i,j);
            ey(i,j) = ey(i,j)+(j-51-Y(k))./r(i,j);
        end
    end
    
    
    E_f = E_f + q.*const./r_square;
    Ex = Ex + E_f.*ex.*const;
    Ey = Ex + E_f.*ey.*const;
end
%-------------------------------------------------------------------------%
%                   PLOT THE RESULTS
%-------------------------------------------------------------------------%
x_range = (1:Nx)-51;
y_range = (1:Ny)-51;
contour_range = -8:0.02:8;
contour(x_range,y_range,E_f',contour_range,'linewidth',0.7);
axis([-15 15 -15 15]);
colorbar('location','eastoutside','fontsize',12);
xlabel('x ','fontsize',14);
ylabel('y ','fontsize',14);
title('Electric field distribution, E (x,y) in V/m','fontsize',14);
%-------------------------------------------------------------------------%
%                  REFERENCE
% SADIKU, ELEMENTS OF ELECTROMAGNETICS, 4TH EDITION, OXFORD
%-------------------------------------------------------------------------%
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(12.) In nuclear fission, a nucleus splits roughly in half. (a) What is the potential 3.00...
(12.) In nuclear fission, a nucleus splits roughly in half. (a) What is the potential 3.00 ✕ 10-14 m from a fragment that has 46 protons in it? 2.21e+06 V [My Answer 2.21e+6 V] (b) What is the potential energy in MeV of a similarly charged fragment at this distance? [My Answer 102 MeV] (13) In one of the classic nuclear physics experiments at the beginning of the 20th century, an alpha particle was accelerated toward a gold nucleus, and...
A particle with charge 3.20×10?19 C is placed on the x axis in a region where...
A particle with charge 3.20×10?19 C is placed on the x axis in a region where the electric potential due to other charges increases in the +x direction but does not change in the y or z direction. The particle, initially at rest, is acted upon only by the electric force and moves from point a to point b along the x axis, increasing its kinetic energy by 1.12×10?18 J . In what direction and through what potential difference Vb?Va...
A particle with charge 1.60×10−19 C is placed on the x axis in a region where...
A particle with charge 1.60×10−19 C is placed on the x axis in a region where the electric potential due to other charges increases in the +x direction but does not change in the y or z direction. The particle, initially at rest, is acted upon only by the electric force and moves from point a to point b along the x axis, increasing its kinetic energy by 1.44×10−18 J . In what direction and through what potential difference Vb−Va...
A uniform electric field is given (in units of N/C) by E = 63 i –...
A uniform electric field is given (in units of N/C) by E = 63 i – 87 j + 48 k , where i, j, k are unit vectors in the directions of x, y, z axes respectively. Find the magnitude of the electric flux through a circle of a 15 cm cm radius located in the xz-plane
GOAL Use the superposition principle to calculate the electric field due to two point charges. Consider...
GOAL Use the superposition principle to calculate the electric field due to two point charges. Consider the following figure. The resultant electric field  at P equals the vector sum 1 + 2, where 1 is the field due to the positive charge q1and 2 is the field due to the negative charge q2.Two point charges lie along the x-axis in the x y-coordinate plane. Positive charge q1 is at the origin, and negative charge q2 is at (0.300 m, 0). Point...
Two point charges are fixed in place along the x axis as shown in the figure...
Two point charges are fixed in place along the x axis as shown in the figure above. The charge Q1=-3 μμC is located at the origin. The charge Q2=4 μμC is a distance a = 0.46 m to the right of the origin. 1) Calculate the x component of the electric field at point P a distance h=0.32 m above the origin. Ex = -0.115 × 106 N/C Ex = -0.094 × 106 N/C Ex = 0.264 × 106 N/C...
1. A particle of positive charge q and mass m enters parallel uniform electric and magnetic...
1. A particle of positive charge q and mass m enters parallel uniform electric and magnetic fields (of magnitudes E and B, respectively) both directed in the +z direction with a velocity v = v0i perpendicular to both fields. (a) What is the the particle’s initial acceleration? You can give your answer as a vector in component form. (b) What is the radius of the particle’s path (looking down the z-axis) if the magnetic field is B = Bk? Does...
10. A spherical conductor of radius R = 1.5cm carries the charge of 45μ, (a) What...
10. A spherical conductor of radius R = 1.5cm carries the charge of 45μ, (a) What is the charge density (ρ) of the sphere? (b) Calculate the electric field at a point r = 0.5cm from the center of the sphere. (c) What is the electric field on the surface of the sphere? 11. Two capacitors C1 and C2 are in series with a voltage V across the series combination. Show that the voltages V1 and V2 across C1 and...