R =
Note that because ‘zprime’ only enters into your calculations in ‘R’ and that is defined as:
R = sqrt(a^2 + (z_prime - z_prime)^2)
neither of tthem ever appears anywhere else.
Changing that to:
R = sqrt(a^2 + (z - z_prime)^2)
produces this result —
%% Starting Timer and Clearing Plots/Command Line
tic
close all; clc;
%% Fixed Variables and Parameters
% Value of j
j = 1i;
% Speed of light = c = 3*10^8 m/s
c = 3*10^8;
% Frequency = 300 MHz = 300*10^6 Hz = 3*10^8 Hz
f = 300*10^6;
% Value of lambda = c / f
% lambda = wavelength = speed of light / frequency
% lambda = 3*10^8 Hz / 3*10^8 m/s = 1 meter
lambda = c/f;
% Wavenumber value = k
k = (2*pi)/lambda;
% Intrinsic Impedance Value = eta
eta = 120*pi;
% Radius of the wire
a = 0.005*lambda;
% Length of the dipole antenna
L = 0.5*lambda;
% Number of segments
N = 23;
% Delta_Z = Spacing between each segment
% Delta_Z From Lecture Notes = Length / Number of Segments
% So, Delta_Z = L / N = L / 23;
Delta_Z = L / N;
% Declaring "z" and "z_prime" as symbolic variables in MATLAB
syms z z_prime
%% Calculating the Kernel Factor
% R equation
R = sqrt(a^2 + (z - z_prime)^2);
% Factor_1 = (-j*eta) / k
F_1 = (-j*eta) / k;
% Factor_2 = (e^-jKR) / 4*pi*(R)^5
F_2 = exp(-j*k*R) / ( 4*pi*(R)^5 );
% Factor_3 = 1 + jkR
F_3 = 1 + (j*k*R);
% Factor_4 = 2R^2 - 3a^2
F_4 = ( 2*(R)^2 ) - ( 3*(a)^2 );
% Factor_5 = (kaR)^2
F_5 = (k*a*R)^2;
% Kernel Factor
K = (F_1*F_2) * ( (F_3*F_4) + F_5);
%% Calculating Z_11
% z integral boundaries
lower_z = 0;
upper_z = L/N;
% z_prime integral boundaries
lower_z_prime = 0;
upper_z_prime = L/N;
% Defining the Integrand
Z_11_Integrand = K
% Converting the Integrand to a "MATLAB" Function
% Also, defining the integral variables "dz" and "dz_prime"
Z_11_function = matlabFunction(Z_11_Integrand, 'Vars', [z_prime, z])
% Using the integral2 function to calculate Z_11
% integral2 will perform the double integration across "dz" and "dz_prime"
Z_11_Result = -1 * integral2(Z_11_function,lower_z_prime,upper_z_prime,lower_z,upper_z)
toc
.