Complex Numbers and AC Circuits

advertisement
1
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Complex Numbers in MATLAB
We will begin this section by looking at several useful functions in MATLAB related to
complex numbers.
Useful functions in MATLAB related to complex numbers
MATLAB function
Description
Example (MATLAB outputs in red)
real(x)
Real part of complex
number
A = 3 + 4i;
X = real(A)
X=3
imag(x)
Imaginary part of
complex number
A = 3 + 4i;
X = imag(A)
X=4
abs(x)
Magnitude of a complex
number
X = abs(3+4i)
X=5
angle(x)
Angle of a complex
number in radians
Alpha = angle(3+4i)*180/pi
alpha = 53.1301
conj(x)
Complex conjugate of
complex number
A = 3+4i
A = 3.0000 + 4.0000i
X = conj(A)
X = 3.0000 - 4.0000i
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Useful functions in MATLAB related to complex numbers
MATLAB function
Description
Example (MATLAB outputs in red)
[theta, r] = cart2pol(x, y)
Converts from
[Radians,Mag]=cart2pol(3,4)
rectangular to polar form Radians = 0.9273
where theta is in radians Mag = 5
Degrees=Radians*180/pi
Degrees = 53.1301
Note: so 3 + 4i = 553.13
[x, y] = pol2cart(theta, r)
Converts from polar to
rectangular form where
theta is in radians
complex(a,b)
Form complex data from X = complex(3,4)
real and imaginary parts X = 3.0000 + 4.0000i
A = [3;-3;-3;3];
B = [4;4;-4;-4];
C = complex(A,B)
C=
3.0000 + 4.0000i
-3.0000 + 4.0000i
-3.0000 - 4.0000i
3.0000 - 4.0000i
[a,b]=pol2cart(30*pi/180,10)
a = 8.6603
b = 5.0000
Note: so 1030 = 8.6603 + 5i
2
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Useful operations in MATLAB related to complex numbers
MATLAB operations
Description
Example (MATLAB outputs in red)
Exponentiation(^)
Raise a complex number
to a power
X = (1+2i)^2
X = -3.0000 + 4.0000i
Arithmetic operations
-Addition (+)
-Subtraction (-)
-Multiplication (*)
-Division (/)
Converts from polar to
rectangular form where
theta is in radians
A=3+4i;
B=2+6i;
A+B
ans = 5.0000 +10.0000i
A-B
ans = 1.0000 - 2.0000i
A*B
ans = -18.0000 +26.0000i
A/B
ans = 0.7500 - 0.2500i
Exponential polar form
X = 10*exp(30i*pi/180)
X = 8.6603 + 5.0000i
[Real,Imag]=pol2cart(30*pi/180,10)
Real = 8.6603
Imag = 5.0000
Note: So 10ej30 = 1030
3
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Printing Complex Numbers in MATLAB
Some options for printing complex numbers in MATLAB include:
1) Do not suppress printing and accept the default format (rectangular form):
2) Display using fprintf (not perfect, but may be sufficient in some cases)
4
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Printing Complex Numbers in MATLAB
Some options for printing complex numbers in MATLAB include:
3. Convert complex number to a string using num2str( ) and print using %s:
5
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Application of Complex Numbers: AC Circuit Analysis (Phasor Analysis)
AC Circuit Analysis Procedure:
1) Draw the phasor circuit (showing voltage and current sources as phasors and using
complex impedances for the components).
2) Analyze the circuit in the same way that you might analyze a DC circuit.
3) Convert the final phasor result back to the time domain.
Example: Use the total current using phasor analysis by hand.
+
10
50cos(400t) V
_
50 mH
100 uF
30
+
50 uF
V
_
Solution: See next slide
6
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Solution:
phasor circuit:
7
I
10
500 V
j20
30
-j25
-j50
ZT  10  j20  - j25 || (30  j50)
ZT  10  j20  2.8736- j17.8161
ZT  10  j20  18.046 - 80.84
ZT  12.8736 j2.1839  13.05759.63
500
I
 3.7753- j0.6404 3.8293  9.63A
13.05759.63
i(t)  3.8293cos(400t- 9.63) A
EGR 272 – Complex Numbers and AC Circuits using MATLAB
Example: Use MATLAB to solve for the total phasor current.
+
50cos(400t) V
_
10
50 mH
100 uF
30
+
50 uF
V
_
8
Download