summaryrefslogtreecommitdiff
path: root/1319/CH2/EX2.10/2_10.sce
blob: d3fa8496720e1f830f295c38e9aa3354c73630e0 (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
//Using thevenin theorem determine current through 2 ohm resistor

clc;
clear;

// Characteristic equation to find Vth
// 14i1+12i2 = 2
// 12i1+16i2 = 4

// Resistors in the circuit in order from the 2V side
R1=2;
R2=12;
R3=1;
R4=3;

// Voltage Sources
V1=2;
V2=4;

Z=[14 12; 12 16]; // Resistance Matrix
V=[V1; V2]; // Voltage Matrix

I=inv(Z)*V; // Current Matrix

i1=I(1);
i2=I(2);

Vth=V2-(i2*R4);

Reff= R3 +((R1*R2)/(R1+R2));

Zth= Reff*R4/(Reff+R4);

Zl=2; // Resistor Connected between AB

Current = Vth/(Zth+Zl); // Current Through 2 ohm resistor

printf('The Current through 2 ohm resistor connected across AB = %g A\n',Current)