Built-in functions for complex numbers, MATLAB in Mathematics

Assignment Help:

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


Related Discussions:- Built-in functions for complex numbers

Looping, How do I write a product series running from i to n of x''s using ...

How do I write a product series running from i to n of x''s using a for loop?

Writing variables to a file, Writing variables to a File: The save com...

Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Changing dimensions, Changing Dimensions: In addition to transpose ope...

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

Illustration of standard deviation, Illustration of Standard Deviation ...

Illustration of Standard Deviation The less spread out the numbers are, therefore smaller the standard deviation will be, as it is a way of determining the spread of the data.

Pie chart - plot functions, Pie chart - plot functions: The MATLAB als...

Pie chart - plot functions: The MATLAB also has a function pie which will generate a pie chart. Calling the function with the form pie (vec) draws a pie chart, by using the pe

Plot types - plot functions, Plot types: Besides plot and bar, there a...

Plot types: Besides plot and bar, there are another plot types like stem plots, histograms, stem plots, area plots and pie charts, and also other functions which customize the

Types of user-defined functions, Types of User-defined Functions: We k...

Types of User-defined Functions: We know how to write a user-defined function, stored in an M-file, which computes and returns one value. This is merely one type of the functi

Use of string variables, Use of string variables: The Characters invol...

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters

Built-in function for differentiation, Built-in function for Differentiatio...

Built-in function for Differentiation: The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration, >>

Customizing plots, Customizing Plots : There are numerous ways to custo...

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

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd