0% found this document useful (0 votes)
23 views1 page

Additional Variables: Special Matrices

MATLAB contains commands to generate special matrices like ones(), zeros(), eye() and functions like inv() and det(). ones() generates a matrix of all 1s, zeros() generates a matrix of all 0s, eye() generates the identity matrix, inv() computes the inverse of a matrix, and det() computes the determinant of a matrix. MATLAB also supports complex numbers with fully integrated complex arithmetic, where variables can be complex with both real and imaginary parts and basic arithmetic works correctly on both parts. Complex numbers are entered with an i or j term like 1 + 2i.

Uploaded by

Anandha selvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Additional Variables: Special Matrices

MATLAB contains commands to generate special matrices like ones(), zeros(), eye() and functions like inv() and det(). ones() generates a matrix of all 1s, zeros() generates a matrix of all 0s, eye() generates the identity matrix, inv() computes the inverse of a matrix, and det() computes the determinant of a matrix. MATLAB also supports complex numbers with fully integrated complex arithmetic, where variables can be complex with both real and imaginary parts and basic arithmetic works correctly on both parts. Complex numbers are entered with an i or j term like 1 + 2i.

Uploaded by

Anandha selvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Special Matrices

MATLAB has several commands that will produce special matrices. Such commands include
 ones() (matrix of 1s)
 zeros() (matrix of 0s)
 eye() (identity)
 inv() (inverse)
 det() (result is not a matrix) (determinant)
>> ones(3)
ans =
1 1 1
1 1 1
1 1 1
>> zeros(3,2)
ans =
0 0
0 0
0 0
Additional Variables
For most applications MATLAB variables will be assigned to numeric and/or string values.
The
numeric values will usually be real or complex. With the addition of the Symbolic toolbox,
variables can also be declared as symbolic variables. This section will briefly describe some
aspects of working with complex and string variables.
Complex Numbers
MATLAB has fully integrated complex arithmetic. All variables are considered to be
complex
and basic arithmetic operations perform correctly on both the real- and imaginary-part of
complex numbers. The imaginary unit is automatically assigned to i and j. A complex
number
is entered as follows:
>> z = 1 + 2i
z =
1.0000 + 2.0000i
>> w = 1 – 2j
w =
1.0000 - 2.0000i

You might also like