summaryrefslogtreecommitdiff
path: root/1319/CH2/EX2.9/2_9.sce
blob: 1f0a7c645bfa9ebc87f3905af513691e21019ce2 (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
// Superposition Principle to determine current in branch

clc;
clear;

//Order of resistances from left to right in the circuit
r1=2;
r2=12;
r3=1;
r4=2;
r5=3;

V1=2;
V2=4;

// We now short circuit by removing one source and consider the rest of the cicuit
// Hence we will have two cases

//Case 1 4V supply removed and shorted

//Resistances between respective nodes.
rab1=(r4*r5)/(r4+r5);
rac1=rab1+r3;
rcd1=(rac1*r2)/(rac1+r2);

Reff1=rcd1+r1;// Effective resistance in case 1

I1=V1/Reff1; // Current from the 2V source

Iac1=I1*(r2/(r2+rac1));
Iab1=Iac1*(r5/(r5+r4)); //Current in AB from 2V source

//Case 2 2V supply removed and shorted

//Resistances between respective nodes.
rcd2=(r1*r2)/(r1+r2);
rac2=rcd2+r3;
rab2=(rac2*r4)/(rac2+r4);

Reff2=rab2+r5;//Effective resistance in case 2

I2=V2/Reff2; // Current from the 4V source

Iab2=I2*(rac2/(rac2+r4)); //Current in AB from 4V source

Iab=Iab1+Iab2;// Combined Current in AB from both the sources 

disp('amperes',Iab,'The Current through AB (2 ohm resistor) =')