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

clc;
disp("CHAPTER 2");
disp("EXAMPLE 13");

//VARIABLE INITIALIZATION
z=1+(%i*1);                        //load impedance in rectangular form in Ohms
v=20*sqrt(2);                      //amplitude of rms value of voltage in Volts

//SOLUTION
function [zp,angle]=rect2pol(x,y); //function 'rect2pol()' converts impedance in rectangular form to polar form
zp=sqrt((x^2)+(y^2));              //z= (x) + j(y)= (1)+ j(1); 'zp' is in polar form
angle=atan(y/x)*(180/%pi);         //to convert the angle from radians to degrees
endfunction;

//solution (i)
[zp,angle]=rect2pol(1,1);          //since x=1 and y=1
v=v/sqrt(2);
angle_v=100;                       //v=(20/sqrt(2))*sin(ωt+100)
I=v/zp;                            //RMS value of current
angle_I=angle_v-angle;
Im=I*sqrt(2);
disp(sprintf("(i) The current in load is i = %d sin(ωt+%d) A",Im,angle_I));

//solution (ii)
p=(v/sqrt(2))*(I*sqrt(2))*cos(angle*(%pi/180));
disp(sprintf("(ii) The real power is %f W",p));

//solution (iii)
pa=(v/sqrt(2))*(I*sqrt(2));
disp(sprintf("(ii) The apparent power is %f VAR",pa));

//END