blob: cd3f7cde217cc535faf90322fb176a3fe3ae6a8e (
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
|
//Problem 24.02: Determine, in polar and rectangular forms, the current flowing in an inductor of negligible resistance and inductance 159.2 mH when it is connected to a 250 V, 50 Hz supply.
//initializing the variables:
L = 0.1592 ; // in Henry
V = 250; // in Volts
f = 50; // in Hz
R = 0; // in ohms
//calculation:
//for an R–L series circuit, impedance
// Z = R + iXL
XL = 2*%pi*f*L
Z = R + %i*XL
I = V/Z
x = real(I)
y = imag(I)
r = (x^2 + y^2)^0.5
if ((x==0)&(y<0)) then
theta = -90
elseif ((x==0)&(y>0)) then
theta = +90
else
theta = atan(y/x)*180/%pi
end
printf("\n\n Result \n\n")
printf("\n current is (%.0f/_%.0f°) A", r, theta)
|