Question

In: Electrical Engineering

write a matlab code of current distribution in wire antenna using method of moments (pocklington)

write a matlab code of current distribution in wire antenna using method of moments
(pocklington)

Solutions

Expert Solution

function [Zin, Current, ERadiated] = PocklingtonPulseSolution(TotalSegments, NumGauss, WireLength, ...
                            WireRadius, Frequency, ExcitationType, ThetaIn, NumTheta)

% PocklingtonPulseSolution calculates the solution to Pocklington's Integral Equation 
% for a straight wire along z-axis.
%
% CALL:  [Zin, Current, ERadiated] = PocklingtonPulseSolution(TotalSegments, ...
%           NumGauss, WireLength, WireRadius, Frequency, ExcitationType, Theta, NumTheta)
% INPUTS:
%  TotalSegments = total number of thin wire segments to use
%  NumGauss = number of quadrature points for numerical integration
%  WireLength = total wire length (meters)
%  WireRadius = wire radius (meters)
%  Frequency = operating frequency (Hz)
%  ExcitationType = The wire excitation type to use
%       ExcitationType = 0 : Delta-gap source located in center segment
%       ExcitationType = 1 : Theta-polarized incident plane wave
%  ThetaIn = Incident angle of plane wave if ExcitationType = 1 (radians)
%  NumTheta = Number of scattering angles (0 <= theta <= 2*pi)
%
% OUTPUTS:
%  Zin = Input impedance measured at center segment if ExcitationType = 0 (Ohms)
%  Current = Complex-valued current in each segment (Amperes)
%  ERadiated = Complex-valued radiated far-field over NumTheta angles (0 <= theta <= 2*pi)
 
% Reference:
%
% [1] Gibson, Walton C. "The Method of Moments in Electromagnetics," Taylor
% and Francis/CRC, 2008.
%
% Copyright (C) 2007 Tripoint Industries, Inc.
 
                         
                                                    
c = 299792458;                       
Mu = 4.0e-7*pi;
Epsilon = 1.0/(Mu*c*c);
w = 2.0*pi*Frequency;
k = w*sqrt(Mu*Epsilon);
Eta = sqrt(Mu/Epsilon);

TotalElements = TotalSegments;

DeltaZ = WireLength / TotalSegments;

z = linspace(-0.5*WireLength , 0.5*WireLength - DeltaZ, TotalSegments);

% zero matrix
A = zeros(TotalElements);

[GaussZ, GaussW] = lgwt(NumGauss, 0.0, 1);  % Gauss integration weights and locations
GaussZ = GaussZ*DeltaZ;
GaussW = GaussW*DeltaZ;

% Compute the first part of the self term (Eqn. 4.63)
r2 = WireRadius*WireRadius;
num = sqrt(1 + 4*r2/(DeltaZ*DeltaZ)) + 1;
denom = sqrt(1 + 4*r2/(DeltaZ*DeltaZ)) - 1;
self = k*k*log(num/denom) - i*k*k*k*DeltaZ;

% Compute the second part of the self term (Eqn. 4.63)
limit2 = PocklingtonAnalyticTerm(0, DeltaZ/2.0, k, WireRadius);
limit1 = PocklingtonAnalyticTerm(0, -DeltaZ/2.0, k, WireRadius);

% Total self term
self = self + (limit2 - limit1);


% compute first row of matrix only
m = 1;
z_m = z(m) + 0.5*DeltaZ;
for n = 1:TotalElements

    if m == n
        A(m,n) = self;
    else
        term = 0.0;
        % compute numerical part of Pocklington matrix
        for i_gauss = 1:NumGauss
            z_n = z(n) + GaussZ(i_gauss);
            dz = z_m - z_n;
            dz2 = dz*dz;
            r = sqrt(dz2 + r2); % distance between surface point and interior wire point
            r_inv = 1.0/r;
            expterm = exp(-i*k*r)*r_inv;
            term = term + expterm*GaussW(i_gauss);
        end
        limit2 = PocklingtonAnalyticTerm(z_m, z(n) + DeltaZ, k, WireRadius);
        limit1 = PocklingtonAnalyticTerm(z_m, z(n), k, WireRadius);
        A(m,n) = k*k*term + (limit2 - limit1);

    end
end
 
% construct  rest of matrix using first row
A = toeplitz(real(A(1,:))) + i*toeplitz(imag(A(1,:)));

% invert matrix
Ainv = inv(A);

rhs = zeros(TotalElements,1);
j = zeros(TotalElements,1);

% compute the right-hand side
if ExcitationType == 0
    rhs(floor(TotalSegments/2)+1) = -i*4*pi*w*Epsilon*(1.0/DeltaZ);   % delta-gap excitation
elseif ExcitationType == 1
    for m = 1:TotalElements
        z_m = z(m) + 0.5*DeltaZ;
        rhs(m) = PlanewaveExcitation(z_m, k, ThetaIn);
    end
    rhs = -i*4*pi*w*Epsilon*v;
end

% solve for currents
Current = Ainv*rhs;

% array of theta for theta-pol radiated field
Theta = linspace(0.0, 2.0*pi, NumTheta);
for iTheta = 1:NumTheta
    cosTheta = cos(Theta(iTheta));
    sinTheta = sin(Theta(iTheta));
    ERadiated(iTheta) = 0.0;
    for m = 1:TotalElements
        z_m = z(m) + 0.5*DeltaZ;
        ERadiated(iTheta) = ERadiated(iTheta) + DeltaZ*Current(m)*sinTheta*exp(i*k*z_m*cosTheta);
    end
    ERadiated(iTheta) = -(i*w*Mu/(4.0*pi))*ERadiated(iTheta);
end


Zin = 1.0 / Current(floor(TotalSegments/2)+1);

return


function b = PlanewaveExcitation(z, k, Theta)

b = sin(Theta)*exp(i*k*z*cos(Theta));

return


% This function computes the Pockylinton analytic term following Eqn. (4.63)
function x = PocklingtonAnalyticTerm(zm, zp, k, WireRadius)

dz = zm - zp;
r = sqrt(dz*dz + WireRadius*WireRadius);
r_inv = 1.0/r;

x = dz*(1 + i*k*r)*r_inv*r_inv*r_inv*exp(-i*k*r);

return;


Related Solutions

Using MATLAB create a code to locate the centriod and moments of interia about the centriod...
Using MATLAB create a code to locate the centriod and moments of interia about the centriod of a stiffened rectangular plate with or without cut outs,
microstrip antenna shape 4 elements array antenna in matlab code for that. if you know then...
microstrip antenna shape 4 elements array antenna in matlab code for that. if you know then only do or else leave for other. Electrical engineering antenna
Write a MATLAB code for the conjugate gradient method and apply it to solve the system...
Write a MATLAB code for the conjugate gradient method and apply it to solve the system Hx = b, where H is the n×n Hilbert matrix, and b is A times the vector of all ones, for (a) n = 4; (b) n = 8. Compare your numerical solutions with the exact solution (which is the vector of all ones), and report your numerical errors.
Matlab code problems I have to write a code using functions to find out if a...
Matlab code problems I have to write a code using functions to find out if a year is a leap year. I'm on the write track i feel like but I keep getting an error message and matlab isnt helping to troubleshoot. The issue is on line 30. Here is my code: function project_7_mfp() %   PROJECT_7_ABC   project_7_abc() creates a function that prompts the user %   enter a year after 1582 It then determines if it is a leap year %...
Design Rectangular array antenna in HFSS software or 5Ghz frequency and MATLAB CODE FOR IT. need...
Design Rectangular array antenna in HFSS software or 5Ghz frequency and MATLAB CODE FOR IT. need all the output waveform regarding that Design microstrip array antenna in HFSS software and MATLAB CODE FOR IT. IF YOU KNOW THEN ONLY DO OR ELSE LEAVE FOR OTHER ANTENNA ,ELECTRICAL ENGINEERING
Design a microstrip shape 4 elements array antenna in ansys.and also matlab code for that.
Design a microstrip shape 4 elements array antenna in ansys.and also matlab code for that.  
The following code must be written using matlab and must be using a for-loop. NOTE! Write...
The following code must be written using matlab and must be using a for-loop. NOTE! Write a computer program that assigns random integers for each entry and generates a row vector. Different random integers should be drawn from different intervals for position 1, position 2, position3 and position 4 of the array. After these first 4 positions are drawn. The whole thing should start over where position5 drawn from same interval as positions 1, position6 drawn from same interval as...
The following code must be written using matlab and must be using a for-loop. NOTE! Write...
The following code must be written using matlab and must be using a for-loop. NOTE! Write a computer program that assigns random integers for each entry and generates a row vector. Different random integers should be drawn from different intervals in chunks of 4 , that is chunk1-chunk2-chunk3-chunk4 The parameters for specifying the lintervals by which the random numbers should be drawn should be able to change and be hardcoded in the script, however, be hardcoded in the script.
How to design FIR lowpass filter using matlab. Note : Do not write matlab code. Only...
How to design FIR lowpass filter using matlab. Note : Do not write matlab code. Only explain the steps of designing filter
Design microstrip circular array antenna in HFSS software and MATLAB CODE FOR IT. Design microstrip circular...
Design microstrip circular array antenna in HFSS software and MATLAB CODE FOR IT. Design microstrip circular array antenna in HFSS software and MATLAB CODE FOR IT. IF YOU KNOW THEN ONLY DO OR ELSE LEAVE FOR OTHER ANTENNA ,ELECTRICAL ENGINEERING
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT