Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
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)
4
>> imag(z3)
-3
Differentiation: The derivative of a function y = f(x) can be written as follows or f '(x) and is defined as the rate of change of the dependent variable y with respe
Fliplr function: The fliplr function "flips" the matrix from left to right (in another words the left-most column, the first column, become the last column and so on), and the
Logical Vectors: The relational operators can also be used with the vectors and matrices. For illustration, let's say that there is a vector, and we want to compare each eleme
Standard Deviation The standard deviation is the square root of variance: The built-in function in a MATLAB for the standard deviation is known as std; the standard dev
Illustration of Writing variables to a file: For illustration, in the below session in the Command Window, 3 variables are generated; these are then exhibited using who. Then,
Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt
Plot Functions: Faraway, we have plotted to generate two-dimensional plots and bar to generate bar charts. We have seen how to clear the Figure Window by using clf, and how to
How do I write a product series running from i to n of x''s using a for loop?
Illustration of logical built-in functions: The function find returns the indices of a vector which meet certain criteria. For illustration, to find all the elements in a vect
Illustration of Labels and prompts: The program below prompts the user for endpoints (x1, y1) and (x2, y2) of a line segment, and computes the midpoint of the line segment, th
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!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd