CEM Lab 4 - Merged
CEM Lab 4 - Merged
Date: 21-08-2023
COMPUTATIONAL ELECTROMAGNETICS
LAB EXPERIMENT 4
QUESTION 1:
Abstract:
To plot a graph of electric potential in MATLAB with the given specific
points.
Theory:
The amount of effort required to transport a unit charge from a reference
point to a particular place inside the field without causing an acceleration is
known as the electrostatic potential, also known as the electric field potential, or
potential drop.
The equation V = k [q/r] yields the electric potential (also known as electric
potential energy per unit charge) at a location in an electric field.
Code:
clean all
close all
% Given parameters
Vo = 100.0;
a = 1;
b = a;
x = linspace(0, b, 100);
y = linspace(0, a, 100);
[X, Y] = meshgrid(x, y);
c = -4 * Vo / pi;
% Parameters
initialVelocity = 100.0;
length_a = 1.0;
length_b = length_a;
constant_c = 4 * initialVelocity / pi;
numTerms = 10; % Number of terms in the series
for i = 1:numel(X_points)
x = X_points(i);
y = Y_points(i);
sum = 0.0;
for k = 1:numTerms
n = 2 * k - 1;
al = sin(n * pi * x / length_b);
a2 = sinh(n * pi * y / length_b);
a3 = n * sinh(n * pi * length_a / length_b);
sum = sum + constant_c * al * a2 / a3;
end
Figure 1
Inference:
The algorithm creates a 2D visual depiction of electric fields and
potentials using a grid of computed points. Using arrows to denote the intensity
and direction of the electric field vectors, it illustrates how the area's electric
potential varies. We can better comprehend how potential energy is spread in
space and how charges produce fields thanks to this visualisation.
QUESTION 2:
Abstract:
To plot a graph in MATLAB for flux and equipotent surfaces
Theory:
Equipotential points are those in an electric field that are all at the same
electric potential. A line or curve connecting these places is referred to as an
equipotential line. An equipotential surface is one where such points are present.
A space or volume is referred to as an equipotential volume if these points are
dispersed throughout it.
Moving a charge between two places on an equipotential surface requires no
labour at all. In an equipotential surface, the effort required to transport a point
charge from point VA to point VB is given by
W = q0 (VA –VB)
As VA – VB is equal to zero, the total work done is W = 0.
Code:
% Given parameters
Vo = 100.0;
a = 1;
b = a;
x = linspace(0, b, 100);
y = linspace(0, a, 100);
[X, Y] = meshgrid(x, y);
c = -4 * Vo / pi;
for k = 1:10
n = 2 * k - 1;
al = sin(n * pi * X / b);
a2 = sinh(n * pi * (a - Y) / b);
a3 = n * sinh(n * pi * a / b);
V = V + c * al .* a2 / a3;
end
xlabel('x');
ylabel('y');
title('Flux, Equipotential Lines, and Electric Field Vectors');
legend('Flux Lines', 'Equipotential Lines', 'Electric Field Vectors');
grid on;
axis equal;
axis ij; % Invert y-axis
hold off;
output:
Figure 2
Inference:
The programme produces a graphic representation that shows how
potentials and electric flux interact in a 2D environment. Electric potential may
be visualised by calculating it at several locations and comparing the results.
Incorporating flux lines and arrows to represent the electric field vectors aids in
our comprehension of how charged particles might flow inside the field.
Additionally, the graph's overlaying equipotential lines highlight areas with
constant energy levels.