-
Notifications
You must be signed in to change notification settings - Fork 0
/
RG59Coax.m
239 lines (202 loc) · 6.04 KB
/
RG59Coax.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILENAME: RG59Coax.m
% COURSE: EE5322--21st Century Electromagnetics
% INSTRUCTOR: Raymond C. Rumpf
% NAME: Manuel F. Martinez
% SEMESTER: Spring 2018
% DUE DATE: 02/06/2018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% INITIALIZE MATLAB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RESTORE MATLAB STATE
clear all;
close all;
clc;
% UNITS
meters = 1;
seconds = 1;
degrees = pi/180;
F = 1;
H = 1;
% CONSTANTS
e0 = 8.85418782e-12 * F/meters;
u0 = 1.25663706e-6 * H/meters;
N0 = sqrt(u0/e0);
c0 = 299792458 * meters/seconds;
% OPEN FIGURE WINDOW
figure('Color','w');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DASHBOARD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TRANSMISSION LINE PARAMETERS
erin = 2.3 * eye(3,3); % Permittivity tensor of inside of Coax cable
erout = 1.0 * eye(3,3); % Permittivity tensot of outside of Coax cable
r1 = 0.35; % Radius of inner conductor
r2 = 2.5; % Radius of dielectric core
r3 = 2.7; % Thickness of cladding
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DEFINE GRID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SPACER REGIONS
BUFF = 3*r3;
Sx = BUFF;
Sy = BUFF;
% GRID SIZE
Nx = 512;
Ny = 512;
% INITIAL GUESS AT RESOLUTION
dx = Sx/Nx;
dy = Sy/Ny;
% SNAP GRID TO CRITICAL DIMENSIONS
nx = ceil(r1/dx);
dx = r1/nx;
ny = ceil(r1/dy);
dy = r1/ny;
% COMPUTE 2X GRID
Nx2 = 2*Nx;
dx2 = dx/2;
Ny2 = 2*Ny;
dy2 = dy/2;
% GRID AXES
xa = [0:Nx-1]*dx; xa = xa - mean(xa);
ya = [0:Ny-1]*dy; ya = ya - mean(ya);
% 2x GRID AXES
xa2 = [0:Nx2-1]*dx2; xa2 = xa2 - mean(xa2);
ya2 = [0:Ny2-1]*dy2; ya2 = ya2 - mean(ya2);
% CREATE MESH
[Y,X] = meshgrid(ya,xa);
RSQ = (X.^2 + Y.^2);
% CREATE 2X MESH
[Y2,X2] = meshgrid(ya2,xa2);
RSQ2 = (X2.^2 + Y2.^2);
CIN = RSQ2 < ((r3 + r2)/2)^2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BUILD DEVICE ON GRID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INITIALIZE SIGNALS
SIG.V = [0 1 0];
SIG.GND = zeros(Nx,Ny);
SIG.SIG1 = SIG.GND;
SIG.SIG2 = SIG.GND;
% FORCE CONDUCTORS
SIG.GND(:,[1 Ny]) = 1;
SIG.GND([1 Nx],:) = 1;
SIG.SIG1 = RSQ <= r1^2;
SIG.SIG2 = RSQ >= r2^2 & RSQ < r3^2;
% BUILD PERMITTIVITIES ON 2X GRID
% Outside dielectrics
A = RSQ2 <= r1^2;
ER2xx = erout(1,1) * (1 - CIN);
ER2xy = erout(1,2) * (1 - CIN);
ER2yx = erout(2,1) * (1 - CIN);
ER2yy = erout(2,2) * (1 - CIN);
% Inside dielectrics
ER2xx = ER2xx + erin(1,1) * CIN - 1.3*erout(1,1) * A;
ER2xy = ER2xy + erin(1,2) * CIN - 1.3*erout(1,2) * A;
ER2yx = ER2yx + erin(2,1) * CIN - 1.3*erout(2,1) * A;
ER2yy = ER2yy + erin(2,2) * CIN - 1.3*erout(2,2) * A;
% PARSE TO 1x GRID
DEV.ERxx = ER2xx(2:2:Nx2,1:2:Ny2);
DEV.ERxy = ER2xy(1:2:Nx2,2:2:Ny2);
DEV.ERyx = ER2yx(2:2:Nx2,1:2:Ny2);
DEV.ERyy = ER2yy(1:2:Nx2,2:2:Ny2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SIMULATE DEVICE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CALL anisotropicTL.m
RES = [dx dy];
TL = anisotropicTL(RES,DEV,SIG);
% CALCULATE TOTAL FIELD
E = sqrt(abs(TL.Ex).^2 + abs(TL.Ey).^2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% POST-PROCESS DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SET SPACING FOR QUIVER
sp = 18;
% SHOW NUMERICAL PARAMETERS ON CONSOLE
disp(['C = ' num2str(TL.C/1e-12,'%3.5f') ' pF/m']);
disp(['L = ' num2str(TL.L/1e-09,'%3.5f') ' nH/m']);
disp(['Z0 = ' num2str(TL.Z0) ' Ohms']);
disp(['nEff = ' num2str(TL.nEff)]);
% VISUALIZE POTENTIAL AND FIELDS
imagesc(xa,ya,TL.V');
colormap(hot);
set(gca,'FontSize',12,'FontWeight','bold');
colorbar;
axis equal tight;
title('Electric Potential V','FontSize',14);
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
figure('Color','w');
imagesc(xa,ya,E');
caxis([0 0.75]);
set(gca,'FontSize',12,'FontWeight','bold');
colorbar
colormap(hot);
axis equal tight;
title('|E|','FontSize',14);
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
hold on;
% ADD QUIVER
[Y,X] = meshgrid(ya,xa);
quiver(X(1:sp:Nx,1:sp:Ny),Y(1:sp:Nx,1:sp:Ny),TL.Ex(1:sp:Nx,1:sp:Ny),...
TL.Ey(1:sp:Nx,1:sp:Ny),'Color','w');
hold off;
% VISUALIZE DIELECTRIC TENSORS
figure('Color','w');
a = subplot(2,2,1);
set(a,'FontSize',12);
imagesc(xa2,ya2,ER2xx');
title('$\varepsilon_{xx}$','FontSize',14,'Interpreter','LaTex');
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
%caxis([1.5 +1.5*max(ER2xx(:))]);
colorbar;
colormap(hot);
a = subplot(2,2,2);
set(a,'FontSize',12);
imagesc(xa2,ya2,ER2xy');
title('$\varepsilon_{xy}$','FontSize',14,'Interpreter','LaTex');
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
%caxis([-2*max(ER2xy(:)) +2*max(ER2xy(:))]);
colorbar;
colormap(hot);
a = subplot(2,2,3);
set(a,'FontSize',12);
imagesc(xa2,ya2,ER2yx');
title('$\varepsilon_{yx}$','FontSize',14,'Interpreter','LaTex');
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
%caxis([-2*max(ER2yx(:)) +2*max(ER2yx(:))]);
colorbar;
colormap(hot);
a = subplot(2,2,4);
set(a,'FontSize',12);
imagesc(xa2,ya2,ER2yy');
title('$\varepsilon_{yy}$','FontSize',14,'Interpreter','LaTex');
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
%caxis([1.5 +1.5*max(ER2yy(:))]);
colorbar;
colormap(hot);
% PLOT CONDUCTORS
figure('Color','w');
imagesc(xa,ya,SIG.GND');
title('GND','FontSize',14);
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
colormap(gray);
colorbar;
caxis([0 1]);
figure('Color','w');
imagesc(xa,ya,SIG.SIG1' | SIG.SIG2');
axis equal tight;
title('SIG1 | SIG2','FontSize',14);
xlabel('x (mm)','FontSize',12);
ylabel('y (mm)','FontSize',12);
colormap(gray);
colorbar;
caxis([0 1]);