5th semester files
This commit is contained in:
21
5th-Semester-Fall-2023/EEMAGS/Homework/H0306a.m
Normal file
21
5th-Semester-Fall-2023/EEMAGS/Homework/H0306a.m
Normal file
@@ -0,0 +1,21 @@
|
||||
clear all;
|
||||
k = 9e9;
|
||||
q1 = 1.0e-6;
|
||||
q2 = -1.0e-6;
|
||||
ax = 1.0;
|
||||
ay = 0;
|
||||
bx = -1.0;
|
||||
by = 0;
|
||||
|
||||
[X, Y] = meshgrid(-2:0.9:2,-2:0.9:2);
|
||||
|
||||
V = 1./sqrt((X - ax).^2 + (Y-ay).^2 ) * k * q1 + 1./sqrt((X-bx).^2 + (Y-by).^2) * k * q2;
|
||||
|
||||
surfc(X, Y, V);
|
||||
|
||||
[Ex, Ey] = gradient(-V, 0.2, 0.2);
|
||||
figure
|
||||
contour(X, Y, V);
|
||||
|
||||
hold on;
|
||||
quiver(X, Y, Ex, Ey);
|
||||
Reference in New Issue
Block a user