Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 1: Create a MATLAB script that computes and plots electrostatic potential u

ID: 2085267 • Letter: P

Question

Part 1:

Create a MATLAB script that computes and plots electrostatic potential using FDT for a rectangular coaxial geometry. The grid for the numerical FDT density should be 2mm by 2mm. code should include method to determine the convergance of solution. present 4 plots clearly labeled and from 4 different angles.

Part 2: numerically calculate the total net charge per unit length Q in C/m on the inner surface of the outer square conductor and the outer surface of the inner rectangular conductor.

Part 3:

calculate the capacitance per unit length C in C/m of the recangular coaxial cable.

Assume:

-Inner conductor = 50V

-Outer conductor = 0V

-Geometry of is a cross section in the x-y plane and the rectangualar coax is uniform in the z direction.

^2V / z^2 = 0

V 50 V 6 cm2 cm 2 cm 2 cm

Explanation / Answer

Hello !

Welcome to Chegg!

Below is the matlab script to compute and plot electrostatic potential using FDT for a rectangular coaxial geometry.It also calculates the total net charge per unit length Q in C/m on the inner surface of the outer square conductor and the outer surface of the inner rectangular conductor and also the capacitance per unit length C in C/m of the recangular coaxial cable.

MATLAB SCRIPT:

%%Welcome to Chegg
%%Calculating electrostatic potential using FDT
%% Calculating the total net charge per unit length Q in C/m on the inner surface of the outer square conductor and the outer surface of the inner rectangular conductor.
%% Calculating the capacitance per unit length C in C/m of the recangular coaxial cable.

%% Assuming Outer dimension is 6*6 and inner is dimension 2X2,Voltage at outer conductor = 0V,Voltage at inner conductor = 50V

clc
close all
clear all

% Outer dimension 6X6 and inner dimension 2X2
Vd = 50; % Voltage at inner conductor
Vc = 0; % Voltage at outer conductor

% along x - direction
a = 2;
b = 2;
c = 2;

% along y - direction
d = 2;
e = 2;
f = 2;

h = 36;% number of steps between unit length
dx = 1/h;
dy = 1/h;

x = 0:dx:(a+b+c);
y = 0:dy:(d+e+f);

A = length(0:dx:a); % 1st end of inner conductor along x- direction
B = length(0:dx:a+b); % 2nd end of inner conductor along x- direction
C = length(0:dx:a+b+c); % Position of outer conductor along x- direction
D = length(0:dy:d); % 1st end of inner conductor along y- direction
E = length(0:dy:d+e); % 2nd end of inner conductor along y- direction
F = length(0:dy:d+e+f); % Position of outer conductor along y- direction

phi = zeros(F,C); % initialising variable

% Assigning voltage at outer boundary

phi(2,:) = Vc;
phi(F,:) = Vc;
phi(:,2) = Vc;
phi(:,C) = Vc;

% Assigning voltage at inner conductor and intialising all free node to 0V

for l = 3:F-1
    for m = 3:C-1
        if (m>=A && m<=B) && (l>=D && l<=E)
           phi(l,m) = Vd;          
        else
           phi(l,m) = 0;
        end
    end
end

% solving Laplace equation by Finite-Difference scheme
p = 2;
v(:,:,p) = phi;
phi_initial = phi;
error1 = v(:,:,p)-zeros(F,C);
error2 = rms(rms(error1)); % RMS error between two iteration
RMS_err(p) = error2; % Storing RMS error between iterations
while error2 > 1e-30   % Implementing iteration method
    p = p+1;
  
  
for l = 3:F-1
  
    for m = 3:C-1
      
        if (m>=A && m<=B) && (l>=D && l<=E)
           phi(l,m) = 2;          
        else
           phi(l,m)= (phi(l,m-1)+phi(l,m+1)+phi(l-1,m)+phi(l+1,m))/4;
        end
            
    end
end

v(:,:,p)= phi;
error1 = v(:,:,p)-v(:,:,p-1);
error2 = rms(rms(error1));
RMS_err(p) = error2; % Storing RMS error between iterations
mesh(x,y,phi,'Linewidth',2)
pause(0.01)
end

mesh(x,y,phi,'Linewidth',2)
xlabel('x ightarrow')
ylabel('leftarrow y')
zlabel('Potential ightarrow')
title('Potential distribution on a air filled coax rectangular Tx line')
colorbar
set(get(gca,'xlabel'),'FontSize', 18, 'FontWeight', 'Bold');
set(get(gca,'ylabel'),'FontSize', 18, 'FontWeight', 'Bold');
set(get(gca,'zlabel'),'FontSize', 18, 'FontWeight', 'Bold');
set(get(gca,'title'),'FontSize', 18, 'FontWeight', 'Bold');
% box off; axis square;
set(gca,'LineWidth',2);
set(gca,'FontSize',14);
set(gca,'FontWeight','Bold');
set(gcf,'color','w');
set(gcf,'PaperUnits','inches');
set(gcf,'PaperSize', [12 12]);
set(gcf,'PaperPosition',[0.5 0.5 7 7]);
set(gcf,'PaperPositionMode','Manual');

% Plotting convergence of solution
figure
plot(RMS_err(1:250),'Linewidth',2)
axis([0 250 0 0.5])
xlabel('No of Iteration ightarrow')
ylabel('RMS error between two iteration ightarrow')

title('Convergence of solution of rectangular coax Tx line without using symmetricity by FD method')

set(get(gca,'xlabel'),'FontSize', 18, 'FontWeight', 'Bold');
set(get(gca,'ylabel'),'FontSize', 18, 'FontWeight', 'Bold');
set(get(gca,'title'),'FontSize', 18, 'FontWeight', 'Bold');
% box off; axis square;
set(gca,'LineWidth',2);
set(gca,'FontSize',14);
set(gca,'FontWeight','Bold');
set(gcf,'color','w');
set(gcf,'PaperUnits','inches');
set(gcf,'PaperSize', [12 12]);
set(gcf,'PaperPosition',[0.5 0.5 7 7]);
set(gcf,'PaperPositionMode','Manual');

%% Calculating charge enclosed by area just outside the inner conductor by
% Gauss's Law
K1 =sum((phi(D,A:B)- phi(D-1,A:B))) + sum ((phi(E,A:B)-phi(E+1,A:B))) + sum((phi(D:E,A)- phi(D:E,A-1))) + sum((phi(D:E,B)-phi(D:E,B+1)));

% Calculating charge enclosed by area just inside the outer conductor by
% Gauss's Law
K2 =sum((phi(3,3:C-1)- phi(2,3:C-1))) + sum((phi(F-1,3:C-1)- phi(F,3:C-1))) + sum((phi(3:F-1,3)- phi(3:F-1,2))) + sum((phi(3:F-1,C-1)- phi(3:F-1,C)));

epsilon = 8.854e-12; % Permitivity of air
Q = epsilon*K1; % Charge enclosed

V = Vd-Vc; % Voltage difference between inner and outer conductor
Cap = Q/V; % Capcitance per unit length