5th semester files
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Lab 6 - Numerical.pdf
Normal file
1
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Lab-06
Normal file
@ -0,0 +1 @@
|
||||
# Created by Octave 8.4.0, Mon Nov 27 11:05:07 2023 EST <sharpe@dhcp-150-250-217-15>
|
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Lab_6_EEMags.pdf
Normal file
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part1.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part2-3D-EField.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part2-3D-Potential.png
Normal file
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 174 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part3-3D-EField.png
Normal file
After Width: | Height: | Size: 129 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part3-Potential.png
Normal file
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 23 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part4-Potential.png
Normal file
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 18 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part5-EField.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/Part5-Potential.png
Normal file
After Width: | Height: | Size: 24 KiB |
129
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/cemLaplace01.m
Normal file
@ -0,0 +1,129 @@
|
||||
% cemLaplace01.m
|
||||
% Solution of Laplace's equation
|
||||
|
||||
clear all
|
||||
close all
|
||||
clc
|
||||
tic
|
||||
|
||||
% INPUTS ================================================================
|
||||
% Number of XY grid points (integer)
|
||||
Nx = 10; Ny = 10;
|
||||
% Range for X and Y values [minX maxX minY maxY minZ maxZ]
|
||||
XY = [0 2 0 1];
|
||||
% tolerance for ending iterations
|
||||
tol = 0.1;
|
||||
% number of iteriations
|
||||
maxN = 50;
|
||||
% limits for electric field plot
|
||||
minXL = 0 ; maxXL = 2;
|
||||
minYL = 0; maxYL = 1;
|
||||
|
||||
% Boundary values for the potential
|
||||
V0 = 10;
|
||||
V = zeros(Ny,Nx);
|
||||
V(:,1) = 20;
|
||||
V(:,end) = 10;
|
||||
V(1,:) = -5;
|
||||
V(end,:) = -10;
|
||||
|
||||
% SETUP ==================================================================
|
||||
|
||||
minX = XY(1); maxX = XY(2);
|
||||
minY = XY(3); maxY = XY(4);
|
||||
x = linspace(minX, maxX,Nx);
|
||||
y = linspace(minY, maxY,Ny);
|
||||
[xx, yy] = meshgrid(x,y);
|
||||
hx = x(2) - x(1); hy = y(2) - y(1);
|
||||
Kx = hx^2/(2*(hx^2+hy^2)); Ky = hy^2/(2*(hx^2+hy^2));
|
||||
|
||||
|
||||
|
||||
% CALCULATIONS ===========================================================
|
||||
|
||||
% dSum difference in sum of squares / n number of iterations
|
||||
dSum = 1; n = 0; cc = 0;
|
||||
|
||||
while n < maxN
|
||||
%while dSum > tol
|
||||
sum1 = sum(sum(V.^2));
|
||||
|
||||
for ny = 2: Ny-1
|
||||
|
||||
for nx = 2: Nx-1
|
||||
V(ny,nx) = Ky * (V(ny,nx+1) + V(ny,nx-1)) + Kx * (V(ny+1,nx) + V(ny-1,nx));
|
||||
% end
|
||||
|
||||
% V(ny,nx) = Ky * (V(ny,nx+1) + V(ny,nx-1)) + Kx * (V(ny+1,nx) + V(ny-1,nx));
|
||||
end
|
||||
% V(ny,Nx) = Ky * (V(ny,Nx) + V(ny,Nx-2)) + Kx * (V(ny+1,Nx) + V(ny-1,Nx));
|
||||
end
|
||||
|
||||
sum2 = sum(sum(V.^2));
|
||||
dSum = abs(sum2 - sum1);
|
||||
n = n + 1; cc = cc+1;
|
||||
end
|
||||
% electric field
|
||||
[Exx, Eyy] = gradient(V,hx,hy);
|
||||
Exx = -Exx; Eyy = -Eyy;
|
||||
E = sqrt(Exx.^2 + Eyy.^2);
|
||||
|
||||
% GRAPHICS ===============================================================
|
||||
|
||||
figure(1) % VECTOR FIELD V -----------------------------------------
|
||||
set(gcf,'units','normalized','position',[0.05 0.5 0.4 0.35]);
|
||||
surf(xx(1:5:end,1:5:end),yy(1:5:end,1:5:end),V(1:5:end,1:5:end));
|
||||
xlabel('x [m]'); ylabel('y [m]'); zlabel('V [ V ]');
|
||||
set(gca,'fontsize',14)
|
||||
rotate3d
|
||||
box on
|
||||
axis tight
|
||||
colorbar
|
||||
view(43,54);
|
||||
|
||||
figure(2)
|
||||
set(gcf,'units','normalized','position',[0.5 0.5 0.4 0.35]);
|
||||
c = 1; yStep = zeros(1,8);
|
||||
for n = 1 : round(Ny/15): round(Ny/2)
|
||||
xP = xx(n,:); yP = V(n,:);
|
||||
plot(xP,yP,'b','linewidth',1.2);
|
||||
hold on
|
||||
c = c+1;
|
||||
yStep(c) = yy(c,1);
|
||||
|
||||
end
|
||||
tt = num2str(yStep,2);
|
||||
text(0.2,95,'y =');
|
||||
text(0.4,95,tt,'fontsize',13)
|
||||
xlabel('x [m]'); ylabel('V [ V ]');
|
||||
set(gca,'fontsize',16)
|
||||
|
||||
figure(3)
|
||||
set(gcf,'units','normalized','position',[0.05 0.05 0.4 0.35]);
|
||||
index1 = 1 : Nx; index2 = 1 : Ny;
|
||||
p1 = xx(index1, index2); p2 = yy(index1, index2);
|
||||
p3 = Exx(index1, index2); p4 = Eyy(index1, index2);
|
||||
h = quiver(p1,p2,p3,p4);
|
||||
set(h,'color',[0 0 1],'linewidth',2)
|
||||
xlabel('x [m]'); ylabel('y [m]');
|
||||
set(gca,'xLim',[minXL, maxXL]);
|
||||
set(gca,'yLim',[minYL, maxYL]);
|
||||
|
||||
figure(4)
|
||||
set(gcf,'units','normalized','position',[0.5 0.05 0.4 0.35]);
|
||||
surf(xx,yy,E);
|
||||
shading interp
|
||||
xlabel('x [m]'); ylabel('y [m]'); zlabel('|E| [ V/m ]');
|
||||
set(gca,'fontsize',14)
|
||||
set(gca,'zTick',[0 1000 2000]);
|
||||
rotate3d
|
||||
box on
|
||||
axis tight
|
||||
colorbar
|
||||
view(43,54);
|
||||
|
||||
|
||||
cc
|
||||
V
|
||||
|
||||
toc
|
204
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/cemLaplace02.m
Normal file
@ -0,0 +1,204 @@
|
||||
% cemLaplace01.m
|
||||
|
||||
% Solution of Laplace's equation
|
||||
clear
|
||||
clc
|
||||
tic
|
||||
|
||||
% INPUTS ================================================================
|
||||
% Number of XY grid points (integer)
|
||||
Nx = 101; Ny = 101;
|
||||
% Range for X and Y values [minX maxX minY maxY minZ maxZ]
|
||||
XY = [0 4 -1 1];
|
||||
% Boundary potential
|
||||
|
||||
% tolerance for ending iterations
|
||||
tol = 1;
|
||||
% limits for electric field plot
|
||||
minXL = 0; maxXL = XY(2);
|
||||
minYL = 0; maxYL = XY(4);
|
||||
|
||||
% boundary values for the potential
|
||||
V0 = 100; V1 = -5; V2 = -10;
|
||||
V = zeros(Ny,Nx);
|
||||
V(:,1) = V0;
|
||||
% V(:,end) = 0;
|
||||
% V(1,:) = 0;
|
||||
% V(end,:) = 0;
|
||||
|
||||
% linearly increasing potentials on boundaries
|
||||
%enter INPUT details in setup
|
||||
|
||||
|
||||
% SETUP ==================================================================
|
||||
|
||||
minX = XY(1); maxX = XY(2);
|
||||
minY = XY(3); maxY = XY(4);
|
||||
x = linspace(minX, maxX,Nx);
|
||||
y = linspace(minY, maxY,Ny);
|
||||
[xx, yy] = meshgrid(x,y);
|
||||
hx = x(2) - x(1); hy = y(2) - y(1);
|
||||
Kx = hx^2/(2*(hx^2+hy^2)); Ky = hy^2/(2*(hx^2+hy^2));
|
||||
|
||||
% V(:,1) = V0 .* cos(2*pi*y/(4*maxY));
|
||||
|
||||
% linearly increasing potentials on boundaries
|
||||
m1 = 20/maxY; m2 = 20/maxX; m3 = 30/maxY; m4 = 10/maxX;
|
||||
b1 = 0; b2 = 20; b3 = 10; b4 = 0;
|
||||
|
||||
V(:,1) = m1 .* y + b1;
|
||||
V(:,end) = m3 .* y + b3;
|
||||
V(end,:) = m2 .* x + b2;
|
||||
V(1,:) = m4 .* x + b4;
|
||||
|
||||
% CALCULATIONS ===========================================================
|
||||
|
||||
% dSum difference in sum of squares / n number of iterations
|
||||
dSum = 10; n = 0;
|
||||
|
||||
while dSum > tol
|
||||
sum1 = sum(sum(V.^2));
|
||||
|
||||
for ny = 2: Ny-1
|
||||
for nx = 2: Nx-1
|
||||
V(ny,nx) = Ky * (V(ny,nx+1) + V(ny,nx-1)) + Kx * (V(ny+1,nx) + V(ny-1,nx));
|
||||
end
|
||||
% uncomment the next line of code if you need to calculate this column of values
|
||||
% V(ny,Nx) = Ky * (V(ny,Nx) + V(ny,Nx-2)) + Kx * (V(ny+1,Nx) + V(ny-1,Nx));
|
||||
end
|
||||
|
||||
sum2 = sum(sum(V.^2));
|
||||
dSum = abs(sum2 - sum1);
|
||||
n = n+1;
|
||||
dSum
|
||||
end
|
||||
% electric field
|
||||
[Exx, Eyy] = gradient(V,hx,hy);
|
||||
Exx = -Exx; Eyy = -Eyy;
|
||||
E = sqrt(Exx.^2 + Eyy.^2);
|
||||
|
||||
|
||||
% exact solution for boundary conditions
|
||||
% left boundary V0, other boundaries V = 0
|
||||
% Vexact = (2*V0/pi) .* atan(sin(pi*y(51)/maxX)./sinh(pi*x/maxX));
|
||||
% Vexact = (2*V0/pi) .* atan(1./sinh(pi*x/maxX));
|
||||
|
||||
|
||||
% linearly increasing potentials on boundaries
|
||||
m1 = 20/maxY; m2 = 20/maxX; m3 = 30/maxY; m4 = 10/maxX;
|
||||
b1 = 0; b2 = 20; b3 = 10; b4 = 0;
|
||||
|
||||
V(:,1) = m1 .* y + b1;
|
||||
V(:,end) = m3 .* y + b3;
|
||||
V(end,:) = m2 .* x + b2;
|
||||
V(1,:) = m4 .* x + b4;
|
||||
|
||||
% GRAPHICS ===============================================================
|
||||
|
||||
figure(1) % VECTOR FIELD V -----------------------------------------
|
||||
set(gcf,'units','normalized','position',[0.02 0.52 0.3 0.32]);
|
||||
surf(xx(1:5:end,1:5:end),yy(1:5:end,1:5:end),V(1:5:end,1:5:end));
|
||||
xlabel('x [m]'); ylabel('y [m]'); zlabel('V [ V ]');
|
||||
title('potential','fontweight','normal');
|
||||
set(gca,'fontsize',14);
|
||||
rotate3d
|
||||
box on
|
||||
axis tight
|
||||
colorbar
|
||||
view(55,49);
|
||||
% set(gca,'ZTick',[0 5 10]);
|
||||
|
||||
%%
|
||||
figure(2)
|
||||
set(gcf,'units','normalized','position',[0.65 0.52 0.3 0.32]);
|
||||
c = 0; yStep = zeros(1,6);
|
||||
|
||||
for n = 1:10:51
|
||||
xP = xx(n,:); yP = V(n,:);
|
||||
plot(xP,yP,'b','linewidth',1.2);
|
||||
hold on
|
||||
c = c+1;
|
||||
yStep(c) = yy(n,1);
|
||||
|
||||
end
|
||||
tt = num2str(yStep,2);
|
||||
tm1 = 'y = ';
|
||||
tm2 = tt;
|
||||
tm = [tm1 tm2];
|
||||
xlabel('x [m]'); ylabel('V [ V ]');
|
||||
set(gca,'fontsize',16)
|
||||
h_title = title(tm);
|
||||
set(h_title,'fontsize',12,'FontWeight','normal');
|
||||
|
||||
|
||||
% hold on
|
||||
% plot(x,Vexact,'r');
|
||||
|
||||
%%
|
||||
figure(3)
|
||||
set(gcf,'units','normalized','position',[0.65 0.1 0.3 0.32]);
|
||||
|
||||
hold on
|
||||
sx = x(5);
|
||||
for sy = -1 : 0.1 : 1
|
||||
h = streamline(xx,yy,Exx,Eyy,sx,sy);
|
||||
set(h,'linewidth',2,'color',[1 0 1]);
|
||||
end
|
||||
|
||||
|
||||
index1 = 10 : 1: Nx; index2 = 10 : 1 : Ny;
|
||||
p1 = xx(index1, index2); p2 = yy(index1, index2);
|
||||
p3 = Exx(index1, index2); p4 = Eyy(index1, index2);
|
||||
h = quiver(p1,p2,p3,p4);
|
||||
set(h,'color',[0 0 1],'linewidth',2)
|
||||
xlabel('x [m]'); ylabel('y [m]');
|
||||
|
||||
title('electric field','fontweight','normal');
|
||||
hold on
|
||||
axis equal
|
||||
set(gca,'xLim',[minX,maxX]);
|
||||
set(gca,'yLim',[minY,maxY]);
|
||||
set(gca,'xTick',minX:1:maxX);
|
||||
set(gca,'yTick',minY:1:maxY);
|
||||
set(gca,'fontsize',14)
|
||||
box on
|
||||
|
||||
%%
|
||||
figure(4)
|
||||
set(gcf,'units','normalized','position',[0.02 0.1 0.3 0.32]);
|
||||
surf(xx,yy,E);
|
||||
shading interp
|
||||
xlabel('x [m]'); ylabel('y [m]'); zlabel('|E| [ V/m ]');
|
||||
set(gca,'fontsize',14)
|
||||
%set(gca,'zTick',[0 1000 2000]);
|
||||
rotate3d
|
||||
box on
|
||||
axis tight
|
||||
colorbar
|
||||
view(43,54);
|
||||
title('electric field','fontweight','normal');
|
||||
|
||||
figure(5)
|
||||
set(gcf,'units','normalized','position',[0.33 0.52 0.3 0.32]);
|
||||
contourf(xx,yy,V,16);
|
||||
shading interp
|
||||
xlabel('x [m]'); ylabel('y [m]');
|
||||
title('potential','fontweight','normal');
|
||||
set(gca,'fontsize',14)
|
||||
box on
|
||||
colorbar
|
||||
axis equal
|
||||
|
||||
figure(6)
|
||||
set(gcf,'units','normalized','position',[0.33 0.1 0.3 0.32]);
|
||||
contourf(xx,yy,E,32);
|
||||
shading interp
|
||||
xlabel('x [m]'); ylabel('y [m]');
|
||||
title('electric field','fontweight','normal');
|
||||
set(gca,'fontsize',14)
|
||||
box on
|
||||
colorbar
|
||||
axis equal
|
||||
|
||||
|
||||
toc
|
68
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/cemLaplace03.m
Normal file
@ -0,0 +1,68 @@
|
||||
% cemLaplace01.m
|
||||
|
||||
% Solution of Laplace's equation
|
||||
clear
|
||||
clf
|
||||
tic
|
||||
|
||||
% INPUTS ================================================================
|
||||
|
||||
% Number of XY grid points (integer)
|
||||
Nx = 5;
|
||||
% Range for X and Y values [minX maxX minY maxY minZ maxZ]
|
||||
XY = [0 5];
|
||||
% Boundary potential
|
||||
V0 = 100;
|
||||
% tolerance for ending iterations
|
||||
tol = 0.1;
|
||||
|
||||
% SETUP ==================================================================
|
||||
|
||||
V = zeros(Nx,1);
|
||||
minX = XY(1); maxX = XY(2);
|
||||
x = linspace(minX, maxX,Nx);
|
||||
hx = x(2) - x(1);
|
||||
V(1) = V0; V(Nx) = 0;
|
||||
|
||||
% CALCULATIONS ===========================================================
|
||||
|
||||
% dSum difference in sum of squares / n number of iterations
|
||||
dSum = 10; n = 0;
|
||||
while dSum > tol
|
||||
sum1 = sum(sum(V.^2));
|
||||
|
||||
for nx = 2: Nx-1
|
||||
V(nx) = 0.5*(V(nx+1) + V(nx-1));
|
||||
end
|
||||
sum2 = sum(sum(V.^2));
|
||||
dSum = abs(sum2 - sum1);
|
||||
n = n+1;
|
||||
end
|
||||
|
||||
% exact solution
|
||||
VT = -(V0/maxX)*x + V0;
|
||||
|
||||
% electric field
|
||||
E = -gradient(V,hx);
|
||||
|
||||
% GRAPHICS ===============================================================
|
||||
|
||||
figure(1)
|
||||
set(gcf,'units','normalized','position',[0.05 0.2 0.3 0.4]);
|
||||
subplot(2,1,1)
|
||||
plot(x,V,'b','lineWidth',2);
|
||||
hold on
|
||||
plot(x,VT,'r','lineWidth',2);
|
||||
%set(gca,'xLim',[minX, maxX]);
|
||||
%set(gca,'yLim',[minY, maxY]);
|
||||
xlabel('x [ m ]'); ylabel('V [ V ]');
|
||||
set(gca,'fontsize',14)
|
||||
|
||||
subplot(2,1,2)
|
||||
plot(x,E,'b','lineWidth',2)
|
||||
set(gca,'yLim',[0, 25]);
|
||||
xlabel('x [ m ]'); ylabel('E [ V / m ]');
|
||||
set(gca,'fontsize',14)
|
||||
|
||||
% =======================================================================
|
||||
toc
|
40
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/lab-06.aux
Normal file
@ -0,0 +1,40 @@
|
||||
\relax
|
||||
\providecommand\hyper@newdestlabel[2]{}
|
||||
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
|
||||
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
|
||||
\global\let\oldnewlabel\newlabel
|
||||
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
|
||||
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
|
||||
\AtEndDocument{\ifx\hyper@anchor\@undefined
|
||||
\let\newlabel\oldnewlabel
|
||||
\fi}
|
||||
\fi}
|
||||
\global\let\hyper@last\relax
|
||||
\gdef\HyperFirstAtBeginDocument#1{#1}
|
||||
\providecommand\HyField@AuxAddToFields[1]{}
|
||||
\providecommand\HyField@AuxAddToCoFields[2]{}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {I}Introduction and Background}{1}{section.1}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {II}Part 1}{1}{section.2}\protected@file@percent }
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Approximated and actual electrostatic potential}}{1}{figure.1}\protected@file@percent }
|
||||
\newlabel{fig:part-1}{{1}{1}{Approximated and actual electrostatic potential}{figure.1}{}}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {III}Part 2}{1}{section.3}\protected@file@percent }
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Electric potential between the plates}}{1}{figure.2}\protected@file@percent }
|
||||
\newlabel{fig:part-2-potential}{{2}{1}{Electric potential between the plates}{figure.2}{}}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {IV}Part 3}{1}{section.4}\protected@file@percent }
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Electric field strength between the plates}}{2}{figure.3}\protected@file@percent }
|
||||
\newlabel{fig:part-2-efield}{{3}{2}{Electric field strength between the plates}{figure.3}{}}
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces Electric field inside the rectangle}}{2}{figure.4}\protected@file@percent }
|
||||
\newlabel{fig:part-3-efield}{{4}{2}{Electric field inside the rectangle}{figure.4}{}}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {V}Part 4}{2}{section.5}\protected@file@percent }
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Potential inside the rectangle}}{2}{figure.5}\protected@file@percent }
|
||||
\newlabel{fig:part-3-potential}{{5}{2}{Potential inside the rectangle}{figure.5}{}}
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces Electric field inside the new rectangle}}{2}{figure.6}\protected@file@percent }
|
||||
\newlabel{fig:part-4-efield}{{6}{2}{Electric field inside the new rectangle}{figure.6}{}}
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces Electric potential inside the new rectangle}}{3}{figure.7}\protected@file@percent }
|
||||
\newlabel{fig:part-4-potential}{{7}{3}{Electric potential inside the new rectangle}{figure.7}{}}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {VI}Part 5}{3}{section.6}\protected@file@percent }
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {8}{\ignorespaces The electric field inside a rectangle with non-constant boundary potential}}{3}{figure.8}\protected@file@percent }
|
||||
\newlabel{fig:part-5-efield}{{8}{3}{The electric field inside a rectangle with non-constant boundary potential}{figure.8}{}}
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {9}{\ignorespaces The electric potential of a rectangle with non-constant potential}}{3}{figure.9}\protected@file@percent }
|
||||
\newlabel{fig:part-5-potential}{{9}{3}{The electric potential of a rectangle with non-constant potential}{figure.9}{}}
|
||||
\gdef \@abspage@last{3}
|
1402
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/lab-06.log
Normal file
6
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/lab-06.out
Normal file
@ -0,0 +1,6 @@
|
||||
\BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n\000\040\000a\000n\000d\000\040\000B\000a\000c\000k\000g\000r\000o\000u\000n\000d}{}% 1
|
||||
\BOOKMARK [1][-]{section.2}{\376\377\000P\000a\000r\000t\000\040\0001}{}% 2
|
||||
\BOOKMARK [1][-]{section.3}{\376\377\000P\000a\000r\000t\000\040\0002}{}% 3
|
||||
\BOOKMARK [1][-]{section.4}{\376\377\000P\000a\000r\000t\000\040\0003}{}% 4
|
||||
\BOOKMARK [1][-]{section.5}{\376\377\000P\000a\000r\000t\000\040\0004}{}% 5
|
||||
\BOOKMARK [1][-]{section.6}{\376\377\000P\000a\000r\000t\000\040\0005}{}% 6
|
BIN
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/lab-06.pdf
Normal file
141
5th-Semester-Fall-2023/EEMAGS/Labs/Lab-06/lab-06.tex
Normal file
@ -0,0 +1,141 @@
|
||||
\documentclass[conference]{IEEEtran}
|
||||
\usepackage[siunitx]{circuitikz}
|
||||
\usepackage{graphicx}
|
||||
%\usepackage{lipsum}
|
||||
\usepackage{color}
|
||||
\usepackage{enumitem}
|
||||
\usepackage{epsfig}
|
||||
\usepackage{mathptmx}
|
||||
\usepackage{times}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{float}
|
||||
\usepackage{hyperref}
|
||||
%\usepackage{setspace}
|
||||
%\usepackage{tikz}
|
||||
\usepackage{circuitikz}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{textcomp}
|
||||
%\usepgfplotslibrary{external}
|
||||
%\tikzexternalize
|
||||
%\usepackage[utf8]{inputenc}
|
||||
%\usepackage[english]{babel}
|
||||
%\usepackage{pgf}
|
||||
\usepackage[final]{pdfpages}
|
||||
\usepackage{pgfpages}
|
||||
\usepackage[margin=0.4in]{geometry}
|
||||
\usepackage{lmodern}
|
||||
\usepackage{datetime}
|
||||
\usepackage{ragged2e}
|
||||
\input{border.tex}
|
||||
\pgfpagesuselayout{boxed}
|
||||
|
||||
\hyphenation{op-tical net-works semi-conduc-tor}% correct bad hyphenation here
|
||||
|
||||
\font\myfont=cmr12 at 15pt
|
||||
\title{\myfont Simulating Boundary Conditions in Matlab}
|
||||
\author{Aidan Sharpe 916373346}
|
||||
|
||||
|
||||
\providecommand{\keywords}[1]{\textbf{\textit{Keywords---}} #1}
|
||||
\providecommand{\e}[1]{\ensuremath{\times 10^{#1}}}
|
||||
\setlength{\columnsep}{7mm}
|
||||
\pgfplotsset{compat=1.15}
|
||||
\begin{document}
|
||||
\makeatletter
|
||||
\@twocolumnfalse
|
||||
\maketitle
|
||||
\@twocolumntrue
|
||||
\makeatother
|
||||
\begin{abstract}
|
||||
\end{abstract}
|
||||
|
||||
\section{Introduction and Background}
|
||||
This lab focused on approximating simple electromagnetic scenarios using finite element analysis techniques. Through an iterative process, the approximations could be refined to any arbitrary tolerance. Reaching ever tighter tolerances, however, comes at the cost of exponentially more computing power. After a certain point, computing more iterations yields diminishing returns. To decrease error by an order of magnitude requires an order of magnitude more computing power, or at least the relationship is of similar scale. Unfortunately, if the initial error is very large, the amount of computation goes up exponentially for each order of magnitude higher in error.
|
||||
|
||||
\section{Part 1}
|
||||
Part one introduced approximating the electric potential and the electric field strength in one dimension. Since the endpoints were known, continuously iterating over the distance, taking the moving average at each point, a decent approximation could be honed in on to arbitrary precision. In one dimension, the amount of computing power required to evaluate the approximation is minimal. The tolerance was set to 0.1, and the process completed successfully in less than half a second.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part1.png}
|
||||
\caption{Approximated and actual electrostatic potential}
|
||||
\label{fig:part-1}
|
||||
\end{figure}
|
||||
|
||||
The first graphic in figure \ref{fig:part-1} relates voltage to distance. The initial voltage at $x=0$ was 100[V] and the final voltage at $x=5$ was 0[V]. Since the tolerance was so low (0.1), only the red line, representing the approximated voltage is visible. Underneath the red line is a blue line that shows the actual voltage. In the second graphic in figure \ref{fig:part-1}, the actual electric field strength is shown in blue. Since the electric field strength is the negative gradient of electric potential, and voltage had a constant negative slope, the electric field strength is has a positive, constant value.
|
||||
|
||||
\section{Part 2}
|
||||
Part two shifted from a one dimensional problem to a two dimensional one. Here, two metal plates with infinite length and a width of 4 meters were placed parallel to each other separated by two meters. They were connected along the left infinite edge by an insulating strip held at a potential of 100[V].
|
||||
|
||||
The code for this part took a very long time to run. Using the inbuilt timing functions, it took exactly 2276.92 seconds. Since the initial error was around $4\times10^4$ and the desired tolerance was $1\times10^{-3}$. That is seven orders of magnitude difference. While running, each iteration took about a quarter of a second. Given the total time, we can compute the total number of iterations to be around 8000.
|
||||
|
||||
After the algorithm completed, we were greeted with several figures depicting the electric potential and the electric field strength between the two plates.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part2-Heatmap-Potential.png}
|
||||
\caption{Electric potential between the plates}
|
||||
\label{fig:part-2-potential}
|
||||
\end{figure}
|
||||
|
||||
Shown in figure \ref{fig:part-2-potential}, electric potential is clearly strongest close to the middle of the strip and goes to zero close to the plates or far from the strip.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part2-Heatmap-EField.png}
|
||||
\caption{Electric field strength between the plates}
|
||||
\label{fig:part-2-efield}
|
||||
\end{figure}
|
||||
|
||||
While voltage is highest in the middle of the plates, the electric field is strongest close to the plates. This is because the voltage drops off most rapidly where the insulating strip meets the plates. Since electric field is higher when there is a sharper voltage drop, this makes intuitive sense.
|
||||
|
||||
\section{Part 3}
|
||||
Part three analyzes the electric field and electric potential inside a rectangular region. In figure \ref{fig:part-3-efield}, the vectors are normal to the sides of the rectangle along the edges, and are strongest at the centers of each edge. This hints at a strong voltage drop near the centers of each boundary and a relatively constant voltage closer to the center. Based on the electric field alone, the electric potential would likely look like a dome made from an ellipse inscribed in the rectangle convolved with the surface of the rectangle itself.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part3-Vector-EField}
|
||||
\caption{Electric field inside the rectangle}
|
||||
\label{fig:part-3-efield}
|
||||
\end{figure}
|
||||
|
||||
The approximated potential is shown in figure \ref{fig:part-3-potential}. The potential matches the dome shape, flat towards the middle, and dropping off more sharply towards the edges.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part3-Potential}
|
||||
\caption{Potential inside the rectangle}
|
||||
\label{fig:part-3-potential}
|
||||
\end{figure}
|
||||
|
||||
\section{Part 4}
|
||||
Adjusting the voltages at the boundary of the rectangle to be 20[V] when $x=0$, -5[V] when $y=0$, 10[V] when $x$ is at its maximum value, and -10[V] when $y$ is at its maximum value, gives the electric field shown in figure \ref{fig:part-4-efield}. The electric field is again weak in the middle, much weaker than before, and it is stronger near the corners this time. It is also stronger along the left and right sides than it is along the top and bottom. This hints at the shape of the potential. It should be of a similar shape to the previous rectangle, but much weaker for longer in the middle, and it should not drop off as sharply near the edges as before.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part4-Vector-EField}
|
||||
\caption{Electric field inside the new rectangle}
|
||||
\label{fig:part-4-efield}
|
||||
\end{figure}
|
||||
|
||||
Looking at figure \ref{fig:part-4-potential}, the shape matches prediction. It should also be noted that the slope is much larger on the left than on the right. Looking back at the electric field in figure \ref{fig:part-4-efield}, this corresponds to a stronger electric field on the left compared to the right. Also notice the sign of the slopes of the electric potential: a negative slope corresponds to a vector in the positive x direction, and a positive slope corresponds to a vector in the negative x direction. This makes sense since the electric field is the negative gradient of the potential.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part4-Potential}
|
||||
\caption{Electric potential inside the new rectangle}
|
||||
\label{fig:part-4-potential}
|
||||
\end{figure}
|
||||
|
||||
\section{Part 5}
|
||||
Part five deals with linear varying potentials along a boundary. Now, rather than being constant, the potential will change along each boundary. Importantly, since this change is linear, the slope of the potential will be constant along the boundary. The potential is shown in figure \ref{fig:part-5-potential}.
|
||||
|
||||
For most values, electric field will be constant, but at the corners, the slope changes, so the filed will take on some value. This can be seen in figure \ref{fig:part-5-efield}.
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part5-EField}
|
||||
\caption{The electric field inside a rectangle with non-constant boundary potential}
|
||||
\label{fig:part-5-efield}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=0.48\textwidth]{Part5-Potential}
|
||||
\caption{The electric potential of a rectangle with non-constant potential}
|
||||
\label{fig:part-5-potential}
|
||||
\end{figure}
|
||||
|
||||
\end{document}
|