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
Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector

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).

Complex numbers: A complex number is commonly written in the form z = a + bi here a is known as the real part of the number z, b be the imaginary part of z, and i is √-1

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

Function xlsread - file function: The function xlsread will read from the spreadsheet file. For illustration, to read from file just generated: >> ssnums = xlsread('ranexc

Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen

Empty Vectors: An empty vector or in another words, a vector which stores no values, can be generated using the empty square brackets: >> evec = [] evec = [] >> lengt

Function fopen - file function: The permission string in the call to the fopen function identifies that the file is opened for writing to it. Just as when reading from a file,

Sorting The Sorting is a process of putting a list in order; either in descending (maximum to minimum), or ascending (minimum to maximum) order. For illustration, here is a li

Indexed empty matrix: The Individual elements cannot be eliminated from matrices, as matrices always have the similar number of elements in every row. >> mat = [7 9 8; 4 6