summaryrefslogtreecommitdiff
path: root/1445/CH1/EX1.37/ch1_ex_37.sce
blob: 398178bc5e4a1cc7520d624eab012ed87f58189a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//CHAPTER 1- D.C. CIRCUIT ANALYSIS AND NETWORK THEOREMS 
//Example 37

disp("CHAPTER 1");
disp("EXAMPLE 37");

//VARIABLE INITIALIZATION
v1=90;                              //voltage source in Volts
r1=8;                               //in Ohms
r2=6;                               //in Ohms
r3=5;                               //in Ohms
r4=4;                               //in Ohms
r5=8;                               //diagonal resistance in Ohms
r6=8;                               //in Ohms

//SOLUTION

//using Thevenin's Theorem
//(3)v1+(-2)v2=90...........eq (1)
//(-2)v1+(4)v2=-90..........eq (2)
A=[3 -2;-2 4];
b=[90;-90];
x=inv(A)*b;
v1=x(1,:); 
v2=x(2,:);
vth=v1;
req1=(r1*r5)/(r1+r5); 
req2=req1+r4; 
req3=(req2*r6)/(req2+r6); 
rth=req3+r2;
vab1=(vth*r3)/(rth+r3); 
disp(sprintf("By Thevenin Theorem, the value of V_ab is %f V",vab1));

//using Norton's Theorem
//(13)v1+(-7)v2=270.........eq (1)
//(7)v1+(-13)v2=0...........eq (2)
A=[13 -7;7 -13];
b=[270;0];
x=inv(A)*b;
v1=x(1,:);
v2=x(2,:);
req1=(r1*r5)/(r1+r5);
req2=req1+r4;
req3=(req2*r6)/(req2+r6);
rn=req3+r2;
if(v1>v2) then
In=(v1-v2)/r2;
else
In=(v2-v1)/r2;
end;
vab2=(r3*In)*(rn/(rth+r3)); 
disp(sprintf("By Norton Theorem, the value of V_ab is %f V",vab2));

//END