blob: 48f0ff05fe0131c601bacb8eb948a7cfd311902d (
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 55
clc;
disp("CHAPTER 1");
disp("EXAMPLE 55");
//VARIABLE INITIALIZATION
vcd=50; //voltage source in Volts
v=100; //voltage source in Volts
r1=40; //in Ohms
r2=50; //in Ohms
r3=20; //in Ohms
r4=10; //in Ohms
//SOLUTION
res=(vcd/r2)-(v/r3); //'res' (short for result) is used to make calculations easy
vp=res/((1/r2)+(1/r3)+(1/r4));
vba=vp+v;
disp(sprintf("The voltage between A and B is %f V",vba));
//END
|