CIRCUIT ANALYSIS USING MATLAB
SEE 1023 Teori Litar
2007/2008 - II
Expected Outcome:
At the end of this presentation and hands-on examples,
students should be able to perform equation verifications
using MATLAB
MATLAB
MATLAB – Matrix Laboratory
MATLAB was developed by a lecturer in 1970s – to teach
linear algebra
Later, marketed by Mathworks - 1984
Where to get the student version of MATLAB?
PCs in Power Electronics Lab (P07 – level 2)
PCs in Simulation Lab (P08 – level 3)
Why MATLAB ?
• Its part of the requirements for program accreditation
• Accepted worldwide as tools to solve engineering problems
• You will be using it again (and again) in future courses
• Used to verify your answers for your homework/assignment in
SEE 1023
When to use MATLAB in SEE 1023 ?
• Used to solve simultaneous equations
• To verify that equations written from Nodal/Mesh analysis are correct
• Can be used hand-in-hand with PSpice
Solving CORRECT equations produce similar results with PSpice
Circuit problem
mesh or nodal analysis
Simulate using PSpice
Solve simultaneous eqn using MATLAB
ANSWERS
Examples – DC analysis
v 2 28 v v v
KCL node 2 2 2 3 0 16v 2 12v 3 28
12000 4000 1000
v 3 v2 v
KCL node 3 3 0.007 0 3v 2 4v 3 21
1000 3000
Examples – DC analysis
16 12 v 2 28
3 4 v 21
3
A V = Y
Therefore,
V = A-1 Y
16v 2 12v 3 28
How do we solve this in MATLAB ?
3v 2 4v 3 21
Examples – DC analysis
All variables in MATLAB are matrices
How do we assign values to the variables in MATLAB?
16 12 28
A Y
3 4 21
Examples – DC analysis
All variables in MATLAB are matrices
How we assign values to the variables in MATLAB?
16 12 28
A Y
3 4 21
Examples – DC analysis
Solving simultaneous equations,
V = A-1 Y
Examples – DC analysis
V is a 21 matrix, therefore,
v2 = V(1,1) and v3 = V(2,1)
v2 = 13 V, v3 = 15 V
io = 13/4000 = 3.25mA
Examples – AC analysis
20sin2t 20-90o 0.5H j1
5cos2t 50o 0.25F -j2
v 2 ( j20) v 2 v 2 v 3
KCL node 2: 50 2v 2 j40 j2v 2 j4v 2 j4v 3 20 0
2 j2 j1
v3 v2 v2 v3
KCL node 3: 2 5 0 j4v 3 j4v 2 j4 v 2 20 v 3 0
j1 j2 4
Examples – AC analysis
2v 2 j40 j2v 2 j4v 2 j4v 3 20 0 v 2 (2 j2) v 3 ( j4) 20 j40
j4v 3 j4v 2 j4v 2 20 v 3 0 0v 2 v 3 ( 1 j4) 20
2 j2 j4 v 2 20 j40
0
1 j 4 v
3 20
Examples – AC analysis
2v 2 j40 j2v 2 j4v 2 j4v 3 20 0 v 2 (2 j2) v 3 ( j4) 20 j40
j4v 3 j4v 2 j4v 2 20 v 3 0 0v 2 v 3 ( 1 j4) 20
2 j2 j4 v 2 20 j40
0
1 j 4 v
3 20
v2
i
j2
Examples – AC analysis
I 5.7353 j5.4412 I 7.943.5o A
abs(i) angle(i)*(180/pi)