Professional Documents
Culture Documents
MATLAB Programming
Lecture: 04
Course Instructor
Engr Muhammad Umar Khan Niazi
Office: C1-21, Ext.: 218, Email: umar.niazi@nu.edu.pk
1
2 Built-in Function to Generate Special Matrices
find
Note:
: is use to select all
rows or columns
8 Replacing Part of Array
It is possible to replace a part of an array by using address of element
Command Return
a’ Transpose of a
find(a) Indices of all non-zero elements in a.
fliplr(a) Matrix a, flipped horizontally
flipud(a) Matrix a, flipped vertically.
inv(a) Inverse of a
min(a) Minimum-valued element of a. † † For a matrix, the
max(a) Maximum-valued element of a. † operation will be
carried
numel(a) The number of elements of a.
out separately on
repmat(a,m,n) A matrix where matrix a is repeated in m rows and n columns column.
each For a
reshape(a,m,n) Matrix a reshaped into m rows and n columns. vector (row or
column), the
size(a) The size of a (#rows, #columns, ...)
operation will be
sort(a) Vector a sorted into ascending order. † carried out on the
sum(a) Sum of elements of a. † vector.
unique(a) The list of unique elements of a in ascending order. 9