summaryrefslogtreecommitdiff
path: root/1523/CH2/EX2.20/2_20.sce
blob: a56942a9c1bcf3bc0bb3fa2ebed398b81cb06fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//Network Theorem 1
//page no-2.26
//example2.20
disp("writing equation for supermesh,");
disp("I1-I3=7");....//equation 1
disp("Applying Kvl to the outer path of the supermesh:");
disp("-I1+4*I2-4*I3 = -7");....//equation 2
disp("Applying Kvl to mesh 2:");
disp("I1-6*I2+3*I3 = 0");...//equation 3
disp("Solving equations 1 ,2 and 3");...//solving equations in matrix form
A=[1 0 -1;-1 4 -4;1 -6 3];
B=[7 -7 0]'
X=inv(A)*B;
disp(X);
disp("I1=9 A");
disp("I2=-2.5 A");
disp("I3=-2 A");
x=2.5;
y=2;
z=x-y;
mprintf("\nCurrent through the 3-Ohm resistor = I2-I3 =%.1f A",z);