(→MATLAB and Complex Numbers Examples) |
|||
Line 9: | Line 9: | ||
EX. | EX. | ||
+ | |||
a= 3+2i | a= 3+2i | ||
+ | |||
Finding the conjugate | Finding the conjugate | ||
+ | |||
conj(a) | conj(a) | ||
+ | |||
Finding the real part | Finding the real part | ||
+ | |||
real(a) | real(a) | ||
+ | |||
Finding the imaginary part | Finding the imaginary part | ||
+ | |||
imag(a) | imag(a) | ||
Latest revision as of 13:07, 4 September 2008
MATLAB and Complex Numbers Examples
Defining terms in matlab i =sqrt(-1)
Matlab will return ans = 0 + 1i
EX.
a= 3+2i
Finding the conjugate
conj(a)
Finding the real part
real(a)
Finding the imaginary part
imag(a)
Sample Code
>> a=3+2i
a =3.0000 + 2.0000i
>> conj(a)
ans =3.0000 - 2.0000i
>> real(a)
ans =3
>> imag(a)
ans =2