How To Find A Value In A Matrix Matlab
Introduction to Matrix in Matlab
Matrix in Matlab is a type of variable that is used for mathematical computation purposes. Matlab is known as Matrix Laboratory that efficiently processes matrix calculations. Matrix is a 2-dimensional assortment that is part of linear algebra associated with analytics. Matlab provides inbuilt functionality for creating the matrix and assigning the values to it. There are several mathematical and trigonometric computations supported past Matlab software. Some of the arithmetic operations on the matrix in Matlab are addition, subtraction, multiplication. Similarly, it supports tan, cos, sin, cosec, sec, cot, sin inverse operations. Also operations like complex numbers ciphering and concatenation operations for two matrix values.
Matrix Formation
- Showtime, nosotros will see how to create an array in Matlab. An assortment is a row vector, so to create array commands volition be X = [ i 4 7 half-dozen ]
- In above example, there are four elements in one row. And array name is ' x '.
- An array is a one-dimensional quantity. To create matrix we need to specify a two-dimensional assortment, let us consider one example Matrix A is
To create the in a higher place matrix in MatLab commands will be
A = [ 4 5 6 ; two 1 7 ; 4 0 three ]
- In this elements are written in square brackets ( ' [ ] ' ) and each row separated by semicolon ( ' ; ' ) .
- Screen 1 shows the formation of a matrix that is an analogy of in a higher place instance.
Screen ane: Matrix in Matlab
- Another way is to create a matrix is by using commands zeros, ones, etc.
Example : a=zeros(4,one)
A= 0
0
0
0
- Within the brackets, 4 means 4 rows and 1 is a number of a column.
a=ones(ii,three) … … … Ii rows and three columns.
Ouput:
Screen two: Matrix in Matlab
Operations on Matrix
Below are the different operations on matrix:
i. Arithmetic Operation
It allows all arithmetic operations on a matrix such equally add-on, multiplication, subtraction, etc
Syntax: matrix name operator arithmetics constant
Example:
If a is 4 by 4 matrix with values
four 7 3
four 2 7
8 7 two
four 2 1
In Matlab it will be represented every bit a = [ 4 7 3 ; 4 2 vii ; 8 7 2 ; 4 two ane ]
a + 10
It will give output as
14 17 13
14 12 17
18 17 12
xiv 12 11
For
a – 2
Output volition be
two 5 1
two 0 five
6 five 0
two 0 -ane
Above example shown on screen 3
Screen 3: Arithmetic operations
2. Trigonometric Operations
In this, we can use all trigonometric operators like sin, cos, tan, cosec, sec, cot, sin inverse, etc
Consider one matrix B.
B =5 6 four
three ii 8
Matlab programme will be
B = [ v six iv ; three ii 8 ]
sin ( B )
cos (B )
Output is
Screen 4: Trigonometric Operations
iii. Transpose of Matrix
To find the transpose of the matrix a single quote ( ' ) is used.
Allow united states of america consider matrix X =
Past applying command Ten '
It will give transpose output every bit
Above instance illustrated in screen 5
Screen 5: Transpose of Matrix
4. Matrix Multiplication
Nosotros can perform matrix multiplication. By using the multiplication operator we tin can multiply 2 matrices.
Let us consider Ten is
6 seven 3 2
seven 5 3 i
And transpose of 10 is
6 7
vii 5
3 3
2 ane
Matrix multiplication is given in screen 6.
Screen 6 : Multiplication of Matrix
v. Power
To find power of any variable dot operator ( ' . ' ) is used before ability operator ,Let united states of america consider Matrix X = [ six seven iii two ; 7 5 three 1 ]
X . ^ 3 =
216 343 27 eight
343 125 27 1
half-dozen. Concatenation
Concatenation is used to join two matrix together , square brackets [ ] are used for concatenation operator.
Let us consider one instance Matrix A is
iv 2
5 7
B= [A,A]
Output will be B
four 2 4 2
5 vii five seven
seven. Complex Numbers
Complex numbers are a mixture of two parts. Real part and imaginary parts, mostly to stand for imaginary part ' I ' and ' j ' variable is used.
If we put square root performance in MatLab command window ( sqrt ( -1 ) ) then it gives output as 0.0000 + 1.0000 i
Hither 0 is the real function and 1 is an imaginary role.
Complex numbers representation is as follows ;
A = [ 5 + 3 i , 5 ; two + 2 i , three + ane i ]
It is 2 by 2 matrix, the output will be
5 + 3 i 5
2 + 2 i three + i
Above case illustrated in screen 7
Screen 7: Circuitous Numbers
8. Size
This command is used to find the size of the matrix. Information technology gives the size in the course of rows and columns. (number of rows and number of columns).
Let united states of america consider example A = [ five half dozen eight 2 ; 6 five 4 3 ; 8 vii 2 two ]
Output for size (A) volition be 3 4
Here 3 represents no of rows and 4 represents no of columns.
Screen 8: Size of Matrix
Conclusion – Matrix in Matlab
- In matrix arithmetic addition and subtraction is easy just multiplication is challenging task MatLab makes it unproblematic and MatLab is specially designed for matrix manipulations.
- All the operations can exist easily performed in MatLab such as improver, multiplication, subtraction, trigonometric functions, cross multiplication, matrix transpose, matrix inverse, circuitous numbers, etc
Recommended Articles
This is a guide to Matrix in Matlab. Here we discuss different mathematical operations in the matrix in particular. You can also go through our other suggested articles –
- Transfer Functions in Matlab
- Information Types in MATLAB
- Matlab Operators
- What is Matlab?
- MATLAB Functions
- Square Root in PHP
- Matlab Compiler | Applications of Matlab Compiler
Source: https://www.educba.com/matrix-in-matlab/
Posted by: gabbardmuchich1949.blogspot.com
0 Response to "How To Find A Value In A Matrix Matlab"
Post a Comment