# Mesh and nodal analysis

**Aim**

To analyse resistive-based circuits using Kirchhoff’s current and voltage laws (KCLs and KVLs).

To calculate voltages and currents based on a Matlab program.

**Task 1**

**Nodal analysis of resistive circuits**

Using Kirchhoff’s current law (KCL), the nodal analysis is done by first naming the nodes and calculating the currents at the nodes (Bird, 2017). The nodes are named 1, 2, 3, 4 and 5 while the nodal voltages are named V_{1}, V_{2}, V_{3}, V_{4} and V_{5} as shown in the figure below (Gussow, 2011).

**KCL loop equations**

**Node 1:**

V_{1}/4+ (V_{1}-V_{2})/5+(V_{1}-V_{4})/2=0

Simplifies to

0.95 V_{1}-0.2 V_{2}-0.5 V_{4}=0

Node 2:

(V_{2}-V_{1})/5+V_{2}/10-2=0

-0.2 V_{1}+0.3 V_{2}=2

Node 3:

(V_{3}-V_{4})/5+V_{3}/1+2+5=0

1.2 V_{3}-0.2 V_{4}=-7

Node 4:

(V_{4}-V_{1})/2+(V_{4}-V_{5})/((2+4))+(V_{4}-V_{3})/5=0

-0.5 V_{1}-0.2 V_{3}+13/15 V_{4}-1/6 V_{5}=0

Node 5:

(V_{5}-V_{4})/((2+4))+V_{5}/3-5-1=0

-1/6 V_{4}+0.5 V_{5}=6

The equations are written in matrix form as:

**MATLAB code**

**Task 1: Nodal Analysis**

clc

clear

G1=[0.95 -0.2 0 -0.5 0; -0.2 0.3 0 0 0; 0 0 1.2 -0.2 0; -0.5 0 -0.2 ...

13/15 -1/6; 0 0 0 -1/6 0.5]; %Defining conductance matrix

I1=[0;2; -7; 0; 6]; %Defining the current matrix

G1_inv=inv(G1); %inverse of G1

disp("Task 1: Nodal Voltages from Nodal Analysis")

V1=G1_inv*I1 % Calculation of nodal voltages

Task 1: Nodal Voltages from Nodal Analysis

V1 =

3.7740

9.1827

-5.2504

3.4976

13.1659

Therefore,

V_{1}=3.7740 V,V_{2}=9.1827 V,V_{3}=-5.2504 V, V_{4}=3.4976 V,V_{5}=13.1659

**Task 2**

**Mesh analysis of the resistive circuits**

Using Kirchhoff’s voltage law, the circuit of Task 2 is analyzed as follows (B L Theraja et al., 2012):

**Loop 1:**

4i_{1}+(i_{1}-i_{2} )+3(i_{1}-i_{3} )=0

8i_{1}-i_{2}-3i_{3}=0

Loop 2:

-10+i_{2}+2(i_{2}-i_{4} )+(i_{2}-i_{1} )=0

-i_{1}+4i_{2}-2i_{4}=10

Loop 3:

5+2i_{3}+3(i_{3}-i_{1} )=0

-3i_{1}+5i_{3}=-5

Loop 4:

-5+2(i_{4}-i_{2} )+5(i_{4}-i_{5} )=0

-2i_{2}+7i_{4}-5i_{5}=5

Loop 5:

1+2(i_{5}-i_{6} )+5(i_{5}-i_{4} )=0

-5i_{4}+7i_{5}-2i_{6}=-1

Loop 6:

-3+2(i_{6}-i_{5} )+5i_{6}=0

-2i_{5}+7i_{6}=3

The equations are written in matrix form as:

**MATLAB code**

**Task 2: Mesh Analysis**

R2=[8 -1 -3 0 0 0; -1 4 0 -2 0 0; -3 0 5 0 0 0; 0 -2 0 7 -5 0; 0 0 0 -5 ...

7 -2; 0 0 0 0 -2 7]; %Define the resistance matrix

V2=[0;10; -5; 5; -1; 3]; %Define the voltage matrix

R2_inv=inv(R2); %Obtaining the inverse of resistance

disp("Task 2: Loop Currents from Mesh Analysis")

I2=R2_inv*V2 %Calculation of mesh currents

Task 2: Loop Currents from Mesh Analysis

I2 =

0.3159

4.9585

-0.8105

4.7590

3.6792

1.4798

Therefore:

i_{1}=0.3159 A,i_{2}=4.9585 A,i_{3}=-0.8105 A

i_{4}=4.7590 A,i_{5}=3.6792 A,i_{6}=1.4798 A

**Textbook problem P2.57**

Since the voltage at node 3, (V_{3}) is known to be equal to the controlled voltage source, 2V_{x}, the number of nodes reduces to 2 (A Balakrishnan & T Vasantha Balakrishnan, 2018).

Node 1: -1+(V_{1}-V_{2})/10+(V_{1}-V_{3})/15+V_{1}/5=0

11/30 V_{1}-0.1V_{2}-1/15 V_{3}=1

Node 2:

-2+(V_{2}-V_{1})/10+(V_{2}-V_{3})/10+V_{2}/5=0

-0.1V_{1}+0.4V_{2}-0.1V_{3}=2

At node 3, V3 is given by 2Vx V_{x}

=(V_{2}-V_{1})/10

V_{3}=(V_{2}-V_{1})/5

Simplifying the nodal equations using expression for V3

11/30 V_{1}-0.1V_{2}-1/15×((V_{2}-V_{1} ))/5 =1

19/50 V_{1}-17/150 V_{2}=1

-0.1V_{1}+0.4V_{2}-0.1×((V_{2}-V_{1} ))/5=2

0.12V_{1}+0.38V_{2}=2

In matrix form

**MATLAB Code**

## Textbook Q P2.57

G3=[19/50 -17/150; 0.12 0.38]; %Defining conductance matrixI3=[1;2]; %Defining the current matrixG3_inv=inv(G3); %inverse of G3disp("Task 3: Nodal Voltages for Figure P2.57")V3=G3_inv*I3 % Calculation of nodal voltages

Task 3: Nodal Voltages for Figure P2.57V3 = 3.8397 4.0506

**Textbook P2.58**

Creating a supernode as shown in the figure below, we do the nodal analysis (Hambley, 2019)

We know that;

V_{1}-V_{2}=ai_x

a=5 Ω,i_x=V_{1}/10

V_{1}-V_{2}=0.5V_{1}

0.5V_{1}-V_{2}=0

Considering the supernode;

-5+V_{1}/10+V_{2}/20-3=0

0.1 V_{1}+0.05V_{2}=8

Power delivered (Behzad Razavi, 2015):

P=V^2/R=(ai_x )^2/R=(V_{1}⁄10)^2/8=(V_{1}-V_{2} )^2/8

In matrix form:

**MATLAB Code**

## Textbook Q P2.58

G4=[0.5 -1; 0.1 0.05]; %Defining conductance matrixI4=[0;8]; %Defining the current matrixG4_inv=inv(G4); %inverse of G4disp("Task 4: Nodal Voltages for Figure P2.58")V4=G4_inv*I4 % Calculation of nodal voltages% Power delivered to 8 ohms resistordisp("Power delivered to 8 Ohms resistor")P=((V4(1)-V4(2))^2)/8 %watts

Task 4: Nodal Voltages for Figure P2.58V4 = 64 32Power delivered to 8 Ohms resistorP = 128

** **

**Conclusion**By writing KCL equations, nodal analysis was done in task 1 to obtain the equations with unknown nodal voltages in matrix form. MATLAB program was then used to solve for the nodal voltages. By writing KVL equations, mesh analysis was done in task 2 to determine the loop currents by solving the resulting matrix equations for unknown currents. In Problem P2.57, nodal analysis was used to determine the nodal voltages in a similar way as task 1. Finally, in problem P2.58, nodal analysis was used to calculate the nodal voltages V_{1 }and V_{2} which were then used to calculated power delivered to the 8 â„¦ resistor. The voltage across the 8 â„¦ resistor is the difference of the nodal voltages.

References

A Balakrishnan, & T Vasantha Balakrishnan. (2018). *Electrical circuit theory*. Ibs Buku.

Autor: B L Theraja, Theraja, A. K., & Tarnekar, S. G. (2012). *A textbook of electrical technology. Volume I, Basic electrical engineeringâ€Ż: in S.I. system of units*. S. Chand & Company Ltd.

Behzad Razavi. (2015). *Microelectronics*. Wiley.

Bird, J. (2017). *Electrical circuit theory and technology*. Routledge.

Gussow, M. (2011). *Schaums Outlines of Basic Electricity.* Mcgraw-Hill Education - Europe.

Hambley, A. R. (2019). *Electrical engineeringâ€Ż: principles and applications*. Pearson.

- 24 x 7 Availability.
- Plagiarism Free.
- Trained and Certified Experts.
- Deadline Guaranteed.
- Privacy Guaranteed.
- Assignment Help Reward
- Online help for all project.
- Service for everyone
- Online Tutoring
- Free download.
- Whitepaper.

- Assignment Help
- Homework Help
- Writing Help
- Academic Writing Assistance
- Editing Services
- Plagiarism Checker Online
- Proofreading
- Research Writing Help