 Given are some examples of mesh and nodal analysis and their solutions on MATLAB.

1: Find all mesh currents through mesh analysis method using MATLAB. Solution:

For mesh 1,

-12 + 8 – 5I1 – I2 – 4I4 =0                 4 = 5I1 – I2 – 4I4      (1)

For mesh 2,

-8 + 13I2  – I1 – 10I3  – 2I4 =0                8 = -I1 + 13I2 -10I3 – 2I4       (2)

For mesh 3,

-6 +15I3 – 10I2 – 5I4 =0                 6 = -10I2 + 15I3 – 5I4      (3)

For mesh 4,

-4I1 -2I2 – 5I3 + 14I4 =0      (4)

Putting (1) to (4) in matrix form gives Using MATLAB,

On Command Window:

>> A=[5 -1 0 -4; -1 13 -10 -2; 0 -10 15 -5; -4 -2 -5 14];

>> B=[4 8 6 0]’;

>> I=inv(A)*B

I =

7.2174

8.0870

7.7913

6.0000

2: Find the mesh currents in the circuit of Figure using MATLAB. Solution:

–12 + 4kI1 – 3kI2 – 1kI3 = 0                  (1)

–3kI1 + 7kI2 – 4kI4 = 0

–3kI1 + 7kI2 = –12                  (2)

–1kI1 + 15kI3 – 8kI4 – 6kI5 = 0

–1kI1 + 15kI3 – 6kI4 = –24                  (3)

I4 = 3mA                (4)

–6kI3 – 8kI4 + 16kI5 = 0

–6kI3 + 16kI5 = –24                 (5)

Putting these in matrix form (substituting I4 = 3mA in the above equations),

We get, ZI = V

Using MATLAB,

On Command Window:

>> Z = [4,-3,-1,0;-3,7,0,0;-1,0,15,-6;0,0,-6,16];

>> V = [12,-12,-24,-24]’;

>> I=inv(Z)*V

I =

1.6196

-1.0202

-2.4612

-2.4230

3: Use nodal analysis along with MATLAB to determine the node voltages in Figure: Solution:

At node 1,

4 = (V1-V2)/1 + (V1–V4)/20                  80 = 21V1 – 20V2 – V(1)

At node 2,

(V1-V2)/1 = V2/8 + (V2-V3)/10                 0 = -80V1 + 98V2 – 8V(2)

At node 3,

(V2-V3)/10 = V3/20 + (V3-V4)/10                 0 = -2V2 + 5V3 – 2V(3)

At node 4,

(V1-V4)/20 + (V3-V4)/10 = V4/30                   0 = 3V1 + 6V3 – 11V(4)

Putting (1) to (4) in matrix form gives: B = A V                   V = A-1B

Using MATLAB,

On Command Window:

>>  A=[21 -20 0 -1; -80 98 -8 0; 0 -2 5 -2; 3 0 6 -11];

>> B=[80 0 0 0]’;

>> V=inv(A)*B

V =

25.5247

22.0480

14.8420

15.0569

4: Use nodal analysis along with MATLAB to determine the node voltages in Figure: Solution:

At node 1,

3 = i1 + ix                        3 = (V1 – V3)/4 + (V1-V2)/2

Multiplying by 4 and rearranging terms, we get

3V1 – 2V2 – V3 = 12                  (1)

At node 2,

ix = i2 + i3                             (V1-V2)/2 = (V2-V3)/8 + (V2-0)/4

Multiplying by 8 and rearranging terms, we get

-4V1 + 7V2 – V3 = 0                    (2)

At node 3,

i1 + i2 = 2ix                             (V1-V3)/4 + (V2-V3)/8 = 2(V1-V2)/2

Multiplying by 8, rearranging terms, and dividing by 3, we get

2V1 – 3V2 + V3 = 0                    (3)

Using MATLAB,

On Command Window:

>> A=[3 -2 -1; -4 7 -1; 2 -3 1];

>> B=[12 0 0]’;

>> V=inv(A)*B

V =

4.8000

2.4000

-2.4000