Print an imaginary number, MATLAB in Mathematics

Print an imaginary number:

To print an imaginary number, the function disp will show both parts automatically:

>> disp(z1)

   4.0000 + 2.0000i

The function fprintf will print only the real part unless both parts are printed individually:

>> fprintf('%f\n', z1)

   4.000000

>> fprintf('%f %f\n', real(z1), imag(z1))

4.000000 2.000000

>> fprintf('%f + %fi\n', real(z1), imag(z1))

4.000000 + 2.000000i

Posted Date: 10/22/2012 8:54:55 AM | Location : United States







Related Discussions:- Print an imaginary number, Assignment Help, Ask Question on Print an imaginary number, Get Answer, Expert's Help, Print an imaginary number Discussions

Write discussion on Print an imaginary number
Your posts are moderated
Related Questions
Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

Example of Recursive functions: This definition is recursive as a factorial is defined in terms of the other factorial. There are two parts to any recursive definition: the co

Histogram: The histogram is a particular type of bar chart which shows the frequency of occurrence of the values within a vector. The Histograms use what are known as bins to

Concatenation: The String concatenation means to join the strings altogether. Of course, as strings are merely vectors of the characters, the technique of concatenating vector

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1

Program of built-in factorial function: Calling this function yields similar result as the built-in factorial function: >> fact(5) ans =   120 >> factorial(

Using Functions with the Vectors and Matrices: As MATLAB is written to work with the vectors and matrices, the whole vector or matrix can be passed as an argument to the funct

Creating Customized strings: There are many built-in functions which create customized strings, including blanks, char, and sprintf. We know that the char function can be u

Refer the subset of a matrix: It is also possible to refer to the subset of a matrix. For illustration, this refers to the first & second rows, second & third columns: >> m