Complex Number Operation in Matlab programming

Another advantage of the Matlab programming is the ability to process the data complex numbers without requiring special variable declarations. Here is to declare a variable to the complex numbers:

>> a=2+1.5i
a =
   2.0000 + 1.5000i
>> b=3-4j
b =
   3.0000 -4.0000i

In conclusion, there is no difference using the identifier 'i' or 'j' for the number complex. For the purposes of mathematical calculation it does not take special functions, for example, as follows:

>> a + b
ans =
    5.0000 -2.5000i

As for the separation needs of real and imaginary values can easily done, for example by the following examples:

>>a=2+1.5000i
a= 2.000 + 1.5000i
>> real(a)
ans =
      2
>>imag(a)
ans =
     1.5000

Complex form a + bi in the complex integer arithmetic rectangular shape, whereas the polar form of complex numbers is realized with Magnitude and angle. Conversion from rectangular to polar form in Matlab met through the functions abs and angle.

>> a= 2+1.5i
a =
   2.0000 + 1.5000i
>>abs(a)
ans =
    2.5000
>> angle(a)
ans =
    0.6435

1 comments:

Arun_M said...

The blue is the color that gets scattered easily. Change the font color....

Post a Comment