Built-in functions for complex numbers, MATLAB in Mathematics

Built-in functions for Complex numbers: 

We know that in MATLAB both i and j are built-in functions which return √-1 (therefore, they can be thought of as built-in constants). The Complex numbers can be generated by using i or j, for illustration, 5 + 2i or 3 - 4j. The multiplication operator is not needed between the value of the imaginary part and the constant i or j.

The MATLAB also has a function complex which will return a complex number. It receives two numbers, that is the real and imaginary parts in that order, or only one number that would be the real part (therefore the imaginary part would be 0). Here are a few illustrations of generating complex numbers in a MATLAB:

>> z1 = 4 + 2i

z1 =

   4.0000 + 2.0000i

>> z2 = sqrt(-5)

z2 =

   0 + 2.2361i

>> z3 = complex(3,-3)

z3 =

   3.0000 - 3.0000i

>> z4 = 2 + 3j

z4 =

   2.0000 + 3.0000i

>> z5 = (-4) ^ (1/2)

ans =

   0.0000 + 2.0000i

>> myz = input('Enter a complex number: ')

Enter a complex number: 3 + 4i

myz =

   3.0000 + 4.0000i

 

Note that even when j is used in an expression, i is used in the outcome. The MATLAB displays the type of the variables generated here in the Workspace Window (or by using whos) as double (complex). The MATLAB has functions real and imag which return the real and imaginary parts of complex numbers.

>> real(z1)

ans =

   4

>> imag(z3)

ans =

   -3

Posted Date: 10/22/2012 8:53:35 AM | Location : United States







Related Discussions:- Built-in functions for complex numbers, Assignment Help, Ask Question on Built-in functions for complex numbers, Get Answer, Expert's Help, Built-in functions for complex numbers Discussions

Write discussion on Built-in functions for complex numbers
Your posts are moderated
Related Questions
Strings as Vectors: The Strings are considered as vectors of characters-or in another words, a vector in which each and every element is a single character-so numerous vector

Matrix of Plots: The other function which is very useful with any type of plot is subplot that creates a matrix of plots in the present Figure Window. The three arguments are

Blanks function: The blanks function will generate a string consisting of n blank characters-that are kind of hard to see here! Though, in a MATLAB if the mouse is moved to hi

Animation: In this part we will observe a couple of ways to animate a plot. These are visuals, therefore the outcomes can't really be shown here; it is essential to type these

Dimensions - matrix: The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size func

Counting in a While Loop: Whenever it is not known ahead of the time how many values will be entered into the script, it is often essential to count the number of values which

Recursive Functions: The Recursion occurs whenever something is defined in terms of itself. In the programming, a recursive function is a function which calls itself. The Recu

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

User-defined functions: Therefore, although many functions compute and return values, some do not. A few functions rather merely accomplish a task. Regardless of what type of

Example of Logical built-in functions: For equivalent to all the function, we should make sure that the entire elements in the vector are logically true. The one way of doing