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

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

//SOLUTION

//I1+I2=20...............eq (1)
//-I1+I2=10..............eq (2)
//solving the simultaneous equations by matrix method

A=[1 1;-1 1];
b=[20;10];
I=inv(A)*b;
I1=I(1,:);               //to access 1st element of 2X1 matrix
I2=I(2,:);               //to access 2nd element of 2X1 matrix
disp(sprintf("Current I1= %d A",I1));
disp(sprintf("Current I2= %d A",I2)); 

//END