Assignment title: Information
Question 1
Question1A
The purpose of this question was to write a matlab program that would formulate the
frequency domain MNA sparse equations in the form (G + sC) X = b according to the
following specifications.
Specifications:
INPUT: Your program should be able to input netlist-data. This netlist can
be either in a SPICE-like format (e.g. 'R1 1 2 10000') or equivalent
(e.g. 'res(1 2 10000);').
Components: Your program should be able to stamp all these components:
Resistors (res),
Capacitors (cap),
Inductors (ind),
Voltage sources (vol),
Current sources (cur),
Voltage-controlled voltage sources (vcvs),
Voltage-controlled current sources (vccs).
OUTPUT: Frequency response (magnitude and phase)
These specifications were respected as shown on figure1 below:
Figure 1
Explanation of the code:
From line 1to line 8 this represent my details
Line 9, the matlab command window and workspace are cleared and closed to avoid
any disturbance.
Line 12-16, the variables required for the codes are defined, From line 20 to 26, the netlist files of all circuit elements(resistors, capacitors,
inductors, VCCS, VCVS…) are call
Line 29-33 defined the frequency range, followed b the LU decomposition of G+s*C
to find the vector Matrix X.
The matlab code file is attached to this document as 'Question1A.m'.
Question1B
The purpose of this part is to verify the correctness of the code created in the question1A.
To achieve that, the circuit on figure 2 below was used as a test-circuit.
Figure 2
The resulting matlab code is provided in figure 3 below:Figure 3
This was a success because after running the program, it was possible to find call the G,C and
b matrices in the sparse form in the command window as shown in figure 4 below:Figure 4
The matlab code file is attached to this document as 'question1b'
Question1C
The aim of this part was to use the program created in Question1A to develop a new program
that would compute the frequency response of a general linear circuit. This was done by
adding the code bit in figure 5 below to the code in figure 1 above.Figure 5
The matlab code file of this program is attached to this document as 'Question1C'.
Question 1D
The aim of this part was to verify the correctness of the code in Question1C by applying it to
the circuit used in Question 1B for a random frequency range.
With the a frequency range of 0