summaryrefslogtreecommitdiff
path: root/1445/CH2/EX2.17/Ex2_17.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /1445/CH2/EX2.17/Ex2_17.sce
parent7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff)
downloadScilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip
updated the code
Diffstat (limited to '1445/CH2/EX2.17/Ex2_17.sce')
-rw-r--r--1445/CH2/EX2.17/Ex2_17.sce31
1 files changed, 13 insertions, 18 deletions
diff --git a/1445/CH2/EX2.17/Ex2_17.sce b/1445/CH2/EX2.17/Ex2_17.sce
index 9b4c7c29e..614c7b42a 100644
--- a/1445/CH2/EX2.17/Ex2_17.sce
+++ b/1445/CH2/EX2.17/Ex2_17.sce
@@ -1,18 +1,13 @@
//CHAPTER 2- STEADY-STATE ANALYSIS OF SINGLE-PHASE A.C. CIRCUIT
//Example 17
+clc;
disp("CHAPTER 2");
disp("EXAMPLE 17");
-
-//Given
-//AC Voltage e(t)=141.4.sin (120.t)
-//Current in the circuit is
-//i(t)=14.14.sin (120.t+7.07.cos (120.t+30)
-
//VARIABLE INITIALIZATION
-e=141.4; //in Volts
-E=141.4/sqrt(2); //in Volts
+e=141.4; //amplitude of e(t) in Volts
+E=141.4/sqrt(2); //RMS value of e(t) in Volts
angle_E=0; //in degrees
//i(t)=(14.14<0)+(7.07<120)
i1=14.14; //in Amperes
@@ -21,16 +16,16 @@ i2=7.07; //in Amperes
angle_i2=120; //in degrees
//SOLUTION
-//function to convert from polar form to rectangular form
-function [x,y]=pol2rect(mag,angle);
+function [x,y]=pol2rect(mag,angle); //function 'pol2rect()' converts current in polar form to rectangular form
x=mag*cos(angle*(%pi/180)); //to convert the angle from degrees to radians
y=mag*sin(angle*(%pi/180));
endfunction;
-[i1_x,i1_y]=pol2rect(i1,angle_i1);
-[i2_x,i2_y]=pol2rect(i2,angle_i2);
+//the given current i(t) is composed of two currents i1(t) and i2(t)
+//i1(t) and i2(t) are not mentioned in the book but are considered for the sake of convenience
+[i1_x,i1_y]=pol2rect(i1,angle_i1); //i1(t)= 14.14 sin(120t)
+[i2_x,i2_y]=pol2rect(i2,angle_i2); //i2(t)=7.07 cos(120t+30)
i=(i1_x+i2_x)+(%i*(i1_y+i2_y));
-//function to convert from rectangular form to polar form
-function [mag,angle]=rect2pol(x,y);
+function [mag,angle]=rect2pol(x,y); //function 'rect2pol()' converts current in rectangular form to polar form
mag=sqrt((x^2)+(y^2));
angle=atan(y/x)*(180/%pi); //to convert the angle from radians to degrees
endfunction;
@@ -43,15 +38,15 @@ angle_z=angle_E-angle_I;
[r,xc]=pol2rect(z,angle_z);
f=50;
c=1/(2*%pi*f*(-xc));
-disp(sprintf("(i) The value of resistance is %5.3f Ω",r));
-disp(sprintf(" The value of capacitance is %6.4f μF",c*10^6));
+disp(sprintf("(i) The value of resistance is %f Ω",r));
+disp(sprintf(" The value of capacitance is %f μF",c*10^6));
//solution (ii)
pf=cos(angle_z*(%pi/180));
-disp(sprintf("(ii) The power factor is %4.3f ",pf));
+disp(sprintf("(ii) The power factor is %f ",pf));
//solution (iii)
p=E*I*pf;
-disp(sprintf("(iii) The power absorbed by the source is %d W",p));
+disp(sprintf("(iii) The power absorbed by the source is %f W",p));
//END