summaryrefslogtreecommitdiff
path: root/1445/CH2/EX2.50/Ex2_50.sce
blob: 1c1aa59a3bd6814a91660d4ae028da325284ae45 (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
//CHAPTER 2- STEADY-STATE ANALYSIS OF SINGLE-PHASE A.C. CIRCUIT
//Example 50

disp("CHAPTER 2");
disp("EXAMPLE 50");

//Given
//three impedances
//6+j5 ohm, 8-j6 ohm and 8+j10 ohm
//Circuit in parallel
//
//VARIABLE INITIALIZATION
z1=6+(%i*5);                   //impedance in Ohms
z2=8-(%i*6);                   //impedance in Ohms
z3=8+(%i*10);                  //impedance in Ohms
I=20;                          //in Amperes

//SOLUTION
Y1=1/z1;                       // Admittance
Y2=1/z2;
Y3=1/z3;
Y=Y1+Y2+Y3;                    // Total admittance
//function to convert from rectangular form to polar form
function [Y,angle]=rect2pol(x,y);
Y=sqrt((x^2)+(y^2));           
angle=atan(y/x)*(180/%pi);     //to convert the angle from radians to degrees
endfunction;
[Y_tot,angle]=rect2pol(real(Y),imag(Y));
v=I/Y_tot;
angle_v=-angle;
[z1,angle1]=rect2pol(real(z1),imag(z1));
[z2,angle2]=rect2pol(real(z2),imag(z2));
[z3,angle3]=rect2pol(real(z3),imag(z3));
I1=v/z1;
angle_I1=angle_v-angle1;
I2=v/z2;
angle_I2=angle_v-angle2;
I3=v/z3;
angle_I3=angle_v-angle3;
disp("The current in each branch in polar form is-");
disp(sprintf(" %.3f A, %.2f degrees",I1,angle_I1));
disp(sprintf(" %.3f A, %.2f degrees",I2,angle_I2));
disp(sprintf(" %.3f A, %.2f degrees",I3,angle_I3));
//Total current
I=I1+I2+I3; 
disp(sprintf("The total current is %.3f A",I)); //Answer not clear in the book
//
//END