diff options
Diffstat (limited to '671/CH4/EX4.8/4_8.sce')
-rwxr-xr-x | 671/CH4/EX4.8/4_8.sce | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/671/CH4/EX4.8/4_8.sce b/671/CH4/EX4.8/4_8.sce new file mode 100755 index 000000000..db1a96dca --- /dev/null +++ b/671/CH4/EX4.8/4_8.sce @@ -0,0 +1,41 @@ +function [r,theta]=cart_to_polar(z)
+ x=real(z)
+ y=imag(z)
+ r=norm(z)
+ theta=atan(y/x)
+endfunction
+
+function [x,y]=polar_to_cart(zpolar)
+ r=real(zpolar)
+ theta=imag(zpolar)/180*%pi
+ x=r*cos(theta)
+ y=r*sin(theta)
+endfunction
+
+function Zeq=parallel(Z1,Z2)
+ Zeq=Z1*Z2/(Z1+Z2)
+endfunction
+
+R=200
+L=0.5
+C=50E-6
+w=200
+
+Xl=w*L*%i
+Xc=1/(w*C*%i)
+
+////////////////////////////part a
+Ir=complex(0.02*cos(30*%pi/180),0.02*sin(30*%pi/180))
+V=Ir*R
+Il=V/Xl
+Ic=V/Xc
+I=Ir+Il+Ic
+disp(I)
+
+////////////////////////////part b
+[Ix,Iy]=polar_to_cart(complex(2,-40))
+I=complex(Ix,Iy)
+Zin=parallel(parallel(R,Xc),Xl)
+V=Zin*I
+Ir=V/R
+disp(V,Ir)
\ No newline at end of file |