summaryrefslogtreecommitdiff
path: root/3809/CH6/EX6.8/EX6_8.sce
diff options
context:
space:
mode:
Diffstat (limited to '3809/CH6/EX6.8/EX6_8.sce')
-rw-r--r--3809/CH6/EX6.8/EX6_8.sce31
1 files changed, 31 insertions, 0 deletions
diff --git a/3809/CH6/EX6.8/EX6_8.sce b/3809/CH6/EX6.8/EX6_8.sce
new file mode 100644
index 000000000..97450ce40
--- /dev/null
+++ b/3809/CH6/EX6.8/EX6_8.sce
@@ -0,0 +1,31 @@
+//Chapter 6, Example 6.8
+clc
+funcprot(0)
+//Initialisation
+C=200*10**-6 //capacitance in farad
+R1=5 //resistance in ohm
+R2=50 //resistance in ohm
+L=50*10**-3 //inductance in henry
+pi=3.14 //pi
+w=500 //angular frequency
+v=10 //voltage
+
+//Calculation
+Z1=R1-(%i*(1/(w*C))) //impedance in complex form
+Z2=((R2*w**2*L**2)+(%i*R2**2*w*L))/(R2**2+(w**2*L**2)) //impedance in complex form
+Z=Z2/(Z1+Z2) //impedance in complex form
+V0=v*Z
+
+
+function [r,th]=rect2pol(x,y)
+//rectangle to polar coordinate conversion
+//based on "Scilab from a Matlab User's Point of View", Eike Rietsch,
+2002
+ r=sqrt(x^2+y^2);
+ th = atan(y,x)*180/%pi;
+endfunction
+
+[r,th]=rect2pol(real(V0),imag(V0)) //calling a function
+
+//Results
+printf("vo = %.1f sin( %d t + %.1f )",r,w,th)