summaryrefslogtreecommitdiff
path: root/1445/CH1/EX1.25/Ex1_25.sce
blob: 99feda818b7d2b6cbe31d99a9f97190823164af6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//CHAPTER 1- D.C. CIRCUIT ANALYSIS AND NETWORK THEOREMS 
//Example 25

clc;
disp("CHAPTER 1");
disp("EXAMPLE 25");

//SOLUTION
//(1)I1+(0)I2+(0)I3=5.............eq (1)
//(-20)I1+(50)I2+(-20)I3=0........eq (2)
//(0)I1+(1)I2+(-1)I3=5............eq (3)
//solving the equations by matrix mehod
A=[1 0 0;-20 50 -20;0 1 -1];
b=[5;0;5];
x=inv(A)*b;
I1=x(1,:);                         //to access the 1st element of 3X1 matrix
I2=x(2,:);                         //to access the 2nd element of 3X1 matrix
I3=x(3,:);                         //to access the 3rd element of 3X1 matrix
I=I2;
disp(sprintf("By Mesh analysis, the value of I is %d A",I));

//END