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

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

//VARIABLE INITIALIZATION
r=10;                          //in Ohms
v=200;                         //in Volts
f=50;                          //in Hertz
I=10;                          //in Amperes
rc=2;                          //resistance of coil in Ohms

//SOLUTION

//solution (i)
z=v/I;
xl=sqrt((z^2)-((r+rc)^2));
L=xl/(2*%pi*f);
disp(sprintf("(i) The inductance of the coil is %f H",L));

//solution (ii)
pf=(r+rc)/z;
disp(sprintf("(ii) The power factor is %f",pf));

//solution (iii)
vl=I*(rc+(%i*xl));
//function to convert from rectangular form to polar form
function [mag,angle]=rect2pol(x,y);
mag=sqrt((x^2)+(y^2));         
angle=atan(y/x)*(180/%pi);     //to convert the angle from radians to degrees
endfunction;
[vl,angle_vl]=rect2pol(real(vl),imag(vl));
disp(sprintf("(iii) The voltage across the coil is %f V, %f degrees",vl,angle_vl));

//END