$30
ECSE 543A NUMERICAL METHODS IN ELECTRICAL ENGINEERING
Assignment 1
(Note: Please comment your program listings and explain how they are structured in your report.)
1. (a) Write a program to solve the matrix equation Ax=b by Choleski decomposition. A is a
real, symmetric, positive-definite matrix of order n.
(b) Construct some small matrices (n = 2, 3, 4, or 5) to test the program. Remember that the
matrices must be real, symmetric and positive-definite. Explain how you chose the
matrices.
(c) Test the program you wrote in (a) with each small matrix you built in (b) in the following
way: invent an x, multiply it by A to get b, then give A and b to your program and check
that it returns x correctly.
(d) Write a program that reads from a file a list of network branches (Jk, Rk, Ek) and a reduced
incidence matrix, and finds the voltages at the nodes of the network. Use the code from
part (a) to solve the matrix problem. Explain how the data is organized and read from the
file. Test the program with a few small networks that you can check by hand. Compare
the results for your test circuits with the analytical results you obtained by hand. Cleary
specify each of the test circuits used with a labeled schematic diagram.
2. Take a regular N by 2N finite-difference mesh and replace each horizontal and vertical line by
a 1 k resistor. This forms a linear, resistive network.
(a) Using the program you developed in question 1, find the resistance, R, between the node at
the bottom left corner of the mesh and the node at the top right corner of the mesh, for
N = 2, 3, …, 10. (You will probably want to write a small program that generates the input
file needed by the network analysis program. Constructing by hand the incidence matrix
for a 200-node network is rather tedious).
(b) In theory, how does the computer time taken to solve this problem increase with N, for
large N? Are the timings you observe for your practical implementation consistent with
this? Explain your observations.
(c) Modify your program to exploit the sparse nature of the matrices to save computation
time. What is the half-bandwidth b of your matrices? In theory, how does the computer
time taken to solve this problem increase now with N, for large N? Are the timings you for
your practical sparse implementation consistent with this? Explain your observations.
(d) Plot a graph of R versus N. Find a function R(N) that fits the curve reasonably well and is
asymptotically correct as N tends to infinity, as far as you can tell.
ECSE 543A Page 2 of 2 September 2021
3. Figure 1 shows the cross-section of an electrostatic problem with translational symmetry: a
coaxial cable with a square outer conductor and a rectangular inner conductor. The inner
conductor is held at 15 volts and the outer conductor is grounded.
(a) Write a computer program to find the potential at the nodes of a regular mesh in the air
between the conductors by the method of finite differences. Use a five-point difference
formula. Exploit at least one of the planes of mirror symmetry that this problem has. Use an
equal node-spacing, h, in the x and y directions. Solve the matrix equation by successive
over-relaxation (SOR), with SOR parameter . Terminate the iteration when the magnitude
of the residual at each free node is less than 10−5
.
(b) With h = 0.02, explore the effect of varying . For 10 values of between 1.0 and 2.0,
tabulate the number of iterations taken to achieve convergence, and the corresponding value
of potential at the point (x ,y) = (0.06, 0.04). Plot a graph of number of iterations versus
(c) With an appropriate value of , chosen from the above experiment, explore the effect of
decreasing h on the potential. Use values of h = 0.02, 0.01, 0.005, etc, and both tabulate and
plot the corresponding values of potential at (x, y) = (0.06, 0.04) versus 1/h. What do you think
is the potential at (0.06, 0.04), to three significant figures? Also, tabulate and plot the number
of iterations versus 1/h. Comment on the properties of both plots.
(d) Use the Jacobi method to solve this problem for the same values of h used in part (c). Tabulate
and plot the values of the potential at (x, y) = (0.06, 0.04) versus 1/h and the number of
iterations versus 1/h. Comment on the properties of both plots and compare to those of SOR.
(e) Modify the program you wrote in part (a) to use the five-point difference formula derived in
class for non-uniform node spacing. An alternative to using equal node spacing, h, is to use
smaller node spacing in more “difficult” parts of the problem domain. Experiment with a
scheme of this kind and see how accurately you can compute the value of the potential at (x, y)
= (0.06, 0.04) using only as many nodes as for the uniform case h = 0.01 in part (c).
V = 0
y
x
0.04 m
air
0.08 m
Figure 1.
0.2 m
V = 15