Matlab Presentation
Matlab Presentation
An Introduction With
Application
Mathematical Operation With Arrays
Two vectors can multiply each other only if both have the
same no. of elements and one is a row vector and the other
id column vector. The multiplication of a row vector times a
column vector. The multiplication of a column vector times
a row vector, both with n elements gives an n x n matrix.
Array Division
The division operation is also associated with the rules of
linear algebra. This operation is more complex and only
brief explanation is given below. A fulfil explanation can
be found in books on linear algebra.
The division operation can be explained with the help of
identity matrix and the inverse operation .
Identity Matrix
The identity matrix is a square matrix in which the diagonal
elements are 1`s, and the non diagonal elements are zero`s.
Identity matrix can be created in MATLAB by eye command .
When the identity matrix another matrix, that matrix is
unchanged.
This is equivalent to multiplying a scaler.
Foe example;
Inverse of a Matrix
The matrix B is the inverse of the matrix A if when the two matrix are multiplied the
product is the identity matrix . Both metrices must be square and the multiplications
order can be BA or BA
BA = Ab = I
The inverse matrix A us typically written as In MATLAB the inverse of a matrix can
be obtained either by raising A to the power of -1, or with the INV (A) function.
For Example;
>>A= [ 2 1 4; 4 1 8; 2 -1 3]
A=
2 1 4
4 1 8
2 -1 3
ELEMENT-BY-ELEMENT OPERATIONS
When the regular symbols for multiplication and division are used
with arrays(* and /) the mathematical operations follow the rules of
linear algebra. Elements-by-elements operations can only be done
with arrays of the same size.
Elements-by–elements multiplication, division and exponential of
* Multiplication
^ Exponential
./ Right division
.\ Left division
Element-by -elements
Element-by-element calculations are very useful for calculating the
value of a function at many times of its argument. This is done by
first defining a vector that contain value of the independent
variable, and then using this vector in elements-by-elements
computations to create a vector.
Create a vector z with eight elements