0% found this document useful (0 votes)
38 views

EE2703 End Sem IITM, May 22

This document provides instructions for a final exam assignment involving modeling the current distribution in a half-wave dipole antenna. It specifies that: 1) The antenna should be divided into sections and the current modeled as a vector solved using an equation relating the magnetic field from Ampere's law. 2) A second equation should be derived relating the vector potential to the unknown currents, resulting in a matrix equation. 3) The student should write code to calculate the matrices in the equations, solve for the unknown currents, and produce plots and output in a PDF with their student ID. Comments and formatting are required.

Uploaded by

Jayant Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

EE2703 End Sem IITM, May 22

This document provides instructions for a final exam assignment involving modeling the current distribution in a half-wave dipole antenna. It specifies that: 1) The antenna should be divided into sections and the current modeled as a vector solved using an equation relating the magnetic field from Ampere's law. 2) A second equation should be derived relating the vector potential to the unknown currents, resulting in a matrix equation. 3) The student should write code to calculate the matrices in the equations, solve for the unknown currents, and produce plots and output in a PDF with their student ID. Comments and formatting are required.

Uploaded by

Jayant Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Final Exam for EE2703 (20 Marks) May 02, 2022

Dept. of Electrical Engineering, IIT Madras


Applied Programming Lab Jan 2021 session

 This code involves a lot of vectors and arrays. All such operations should be vector-
ized.

 Label all plots. Add legends. Make the plots professional looking.

 Comments are not optional. They are required.

 There are five sections to the code. Each should have its own pseudocode (you can cut
and paste the question itself here to some extent)

 I expect to see each pseudocode should be readable and neatly formatted.

 PDF file should be named your-roll-number.pdf

 Each array or vector asked for in this assignment should be printed out in the pdf. For
this, use N = 4. The printing of vectors and arrays is messy so use print((MATRIX).round(2)),
where MATRIX is the matrix (or vector) you are printing.

 Only in the case of the matrix P, use “print((P*1e8).round(2))” so that the numbers
are meaningful after rounding to two digits.

 Once you have the code debugged, set N=100 and do the actual calculation (do not
print out all the matrices here!)

 Python code should be named your-roll-number.py Please note that I will accept only
raw python code and it should run in Python 3.x (prefer Python 3.8) So don’t send
me Jupyter notebooks.

 Python code should run!!

 Pdf file should include all plots and tables.

 The Pdf should be submitted to the ’final’ assignment, and the .py code should be
submitted to the ’final-code’ assignment.
This is a problem to find the antenna currents in a half-wave dipole antenna
A long wire carries a current I(z) in a dipole antenna with half length of 50cm - so
the antenna is a metre long, and has a wavelength of 2 metres. We want to determine the
currents in the two wires of the antenna. The standard analysis assumes that the antenna
current is given by ( )
Im sin (k(l − z)) 0 ≤ z ≤ l
I=
Im sin (k(l + z)) −l ≤ z < 0
This is then used to compute the radiated field. The problem is to determine if this is a good
assumption. The parameters of this problem are as follows:
l=0.5 metres (quarter wavelength) c=2.9979e8 m/sec, speed of light mu0=4e-7*pi per-
meability of free space N=4 Number of sections in each half section of the antenna. Set
to N=4 initially and to N=100 later. Im=1.0 current injected into the antenna. a=0.01 me-
tres, radius of wire. Dependent Parameters lamda=l*4.0 metres, wavelength f=c/lamda Hz,
frequency k=2*pi/lamda wave number dz=l/N spacing of current samples

1. Divide the wire into pieces of length dz. Ideally we should number the pieces with
indices going from −N to +N. Unfortunately, Python does not allow negative array
indices, so we will have an array with indices going from 0 to 2N (2N + 1 elements,
with element N being the feed of the antenna).
Define points along the antenna as an array, z,

z = i × dz, −N ≤ i ≤ N

These are the points at which we compute the currents. The currents at end of the
wire are zero, while the currents at z = 0 are prescribed by the circuit driving the
antenna. There is the entering current Im and the return current −Im . Both currents
are at z = 0, and both point in the same direction along the antenna. So a single value
is sufficient. The currents are therefore I[i] for 0 ≤ i ≤ N. So there are 2N + 1 currents,
with 2N − 2 currents unknown (The end currents are known to be zero and current
at the centre is given as Im .) The 2N − 2 locations of unknown currents are computed
and kept in array u. Also construct the current vector I at points corresponding to
vector z, and the current vector J at points corresponding to vector u.

2. We need an equation for each unknown current. These equations are obtained by
calculating the Magnetic field in two different ways. From Ampere’s Law, we have
for Hφ (z, r = a)
2πaHφ (zi ) = Ii
write this as a matrix equation
    
Hφ [z1 ] 1 ... 0 0 ... 0 J1
    

 ... 


 ... ... ... ... ... ... 
 ...
 

 Hφ [zN−1 ]  1  0 ... 1 0 ... 0    JN−1
 
=
   
2πa 
    

 Hφ [zN+1 ] 
  0 ... 0 1 ... 0    JN+1
 


 ... 


 ... ... ... ... ... ... 
 ...
 

Hφ [z2N−1 ] 0 ... 0 0 ... 1 J2N−1
= M∗J

Note that the matrix M assumes Hφ is computed at r = a. Also note that the vector J
is the vector of unknown currents. This is why the matrix is 2N − 2 by 2N − 2.
Write a function to compute and return the matrix M.

3. The second computation involves the calculation of the vector potential

~A(r, z) = µ0 I(z0 )ẑe− jkR dz0


Z

4π R

where ~R =~r −~r0 = rr̂ + zẑ − z0 ẑ and k = ω/c = 0.1. ~r is the point where we want the
field, and~r0 = z0 zˆ0 is the point on the wire. This can be reduced to a sum:

I j exp − jkRi j dz0j



µ0
Az,i = (1)
4π ∑j Ri j
 
µ0 exp(− jkRi j ) 0
= ∑Ij dz j (2)
j 4π Ri j
= ∑ Pi j I j + PBIN (3)
j

again a matrix equation like the previous one. P is a matrix with 2N − 2 columns and
2N − 2 rows. Note that the vector potential is driven by all the currents, which is why
we use the I vector. PB is the contribution to the vector potential due to current IN ,
and is given by
µ0 exp (− jkRiN ) 0
PB = dz j
4π RiN

Compute and create vectors Rz and Ru which are the distances from observer at ~r +
zi ẑ, and source at z0j ẑ. The difference between Rz and Ru is that the former computes
distances including distances to known currents, while Ru is a vector of distances to
unknown currents.
Also compute the matrix P and PB . Note that PB is a column vector.
~ and ~A only has the ẑ component. So the equation
We only want the φ component of H
become
0 !
1 ∂Az µ0 dz j ∂ exp − jkRi j
Hφ (r, z) = − = −∑ Ij
µ ∂r j 4π µ ∂r Ri j

~
q contribute to Hφ , and so the current vector is I. Now, R =
Note that all the currents
rr̂ + (z − z0 )ẑ. So, R = r2 + (z − z0 )2 . The derivative becomes

∂ 1 r
Ri j = 2r =
∂r 2Ri j Ri j

So,

dz0j
!
− jk 1  rI j
Hφ (r, zi ) = − ∑ − 2 exp − jkRi j
j 4π Ri j Ri j Ri j
!  
r − jk 1 r − jk 1
= − ∑ Pi j − 2 I j + PB − Im
j µ0 Ri j Ri j µ0 RiN R2iN
= ∑ Q0i j I j
j

We now have a second expression for Hφ (r, zi ):

Hφ (r, zi ) = ∑ Q0i j I j
j
= ∑ Qi j J j + QBiIm
j

The Q0i j in the equation is over all the currents. However this needs to be split into the
unknown currents, J j and the boundary currents. Only one of the boundary currents
is non-zero, namely the feed current at i = N. The matrix corresponding to J j we call
Qi j , and the boundary current we call QB = Q0iN
Create the matrices Qi j and QB .

5. Our final equation is


MJ = QJ + QB Im

i.e.,
(M − Q) J = QB Im
~ and hence ~I. The current vector can be compared
This is easily solved for to obtain J,
to the standard expression given at the top of the assignment.
Invert (M − Q) and obtain J. Use inv(M-Q) in python. Add the Boundary currents
(zero at i=0, i=2N, and Im at i=N). Then plot this current vs. z and also plot the
equation assumed for current at the top of this question paper.
Explain any discrepancies.

Useful Python Commands (use “?” to get help on these from


ipython)
from pylab import *
import system-function as name
Note: lstsq is found as scipy.linalg.lstsq
ones(List)
zeros(List)
range(N0,N1,Nstep)
arange(N0,N1,Nstep)
linspace(a,b,N)
logspace(log10(a),log10(b),N)
X,Y=meshgrid(x,y)
where(condition)
where(condition & condition)
where(condition | condition)
a=b.copy()
lstsq(A,b) to fit A*x=b
A.max() to find max value of numpy array (similalry min)
A.astype(type) to convert a numpy array to another type (eg int)
def func(args):
...
return List
matrix=c_[vector,vector,...] to create a matrix from vectors
figure(n) to switch to, or start a new figure labelled n
plot(x,y,style,...,lw=...)
semilogx(x,y,style,...,lw=...)
semilogy(x,y,style,...,lw=...)
loglog(x,y,style,...,lw=...)
contour(x,y,matrix,levels...)
quiver(X,Y,U,V) # X,Y,U,V all matrices
xlabel(label,size=)
ylabel(label,size=)
title(label,size=)
xticks(size=) # to change size of xaxis numbers
yticks(size=)
legend(List) to create a list of strings in plot
annotate(str,pos,lblpos,...) to create annotation in plot
grid(Boolean)
show()

You might also like