SlideShare a Scribd company logo
Introduction to matlab lecture 2 of 4
1. >> for = 5
??? for = 5
Error: The expression to the left of the equals sign is not a valid target
for an assignment
2. >> else =6
??? else = 6
Error: Illegal use of reserved keyword "else"
3. >> cos = 2; cos(0)
??? Subscript indices must either be real positive integers or logicals
4. >> A = [1,2,3]; sum(A)
ans = 6
>> sum = 7; sum(A)
??? Index exceeds matrix dimensions
2
5. >> 5>2
ans = 1
6. >> 5<4
ans = 0
7. >> 1.5<=1.5
ans = 1
8. >> 2>=pi
ans = 0
9. >> 1.8==1.801
ans = 0
10. >> 1.8~=2
ans = 1
11. >> 1.8==1.80000000000000000000000001
ans = 1
3
 Creating and manipulating matrices
 Built-in functions for matrices
4
 Matlab treats all variables as matrices.
 Vectors are special forms of matrices and contain only one row OR
one column (A row vector is a 1xn matrix, A column vector is an mx1
matrix).
 Scalars are matrices with only one row AND one column (A scalar is a
1x1 matrix)
 Every matrix element has a numerical value. Non-digit elements
linked to ASCII code digits
A → 65, B → 66, etc.
a → 97, b → 98, etc.
- → 45, _ → 95, etc.
 Logical truth values assigned to digits (true → 1, false → 0)
5
 A matrix with only one row is called a row
vector.
 A row vector can be created in Matlab as
follows (note the commas or you can use
spaces):
» rowvec = [12 , 14 , 63]
rowvec =
12 14 63
6
 A matrix with only one column is called a
column vector.
 A column vector can be created in MATLAB as
follows (note the semicolons):
» colvec = [13 ; 45 ; -2]
colvec =
13
45
-2
7
 A matrix can be created in Matlab as follows
 (note the commas AND semicolons):
 » matrix = [1 , 2 , 3 ; 4 , 5 ,6 ; 7 , 8 , 9]
matrix =
1 2 3
4 5 6
7 8 9
8
 A portion of a matrix can be extracted and stored in
a smaller matrix by specifying the names of both
matrices and the rows and columns to extract.
 The syntax is:
sub_matrix = matrix ( r1 : r2 , c1 : c2 ) ;
where r1 and r2 specify the beginning and ending
rows and c1 and c2 specify the beginning and
ending columns to be extracted to make the new
matrix.
9
10
 Colon Operator
11
 The matrix indices begin from 1 (not 0 (as in C))
 The matrix indices must be positive integer
12
 Accessing Single Elements of a Matrix A(i,j)
 Accessing Multiple Elements of a Matrix
A(1,4) + A(2,4) + A(3,4) + A(4,4)
A([1,3,4], :)= all of rows 1, 3 and 4
sum(A(1:4,4))
sum(A(:,end))
The keyword end refers to the last row or column.
 Deleting Rows and Columns: to delete the second column
of X, use X(:,2) = []
 Concatenating Matrices A and B C=[A;B]
13
14
Logic--searching with find
 Find--searches for the truth (or not false)
› b=[1 0 -1 0 0];
› I=find(b)
I=1 3 b(I) is an array without zeros
› I=find(ones(3,1)*[ 1 2 3]==2)
I= 4 5 6
› [I,J]=find(ones(3,1)*[ 1 2 3]==2)
I= 1 2 3
J= 2 2 2
15
 + addition
 - subtraction
 * multiplication
 ^ power
 ‘ complex conjugate transpose
 / right matrix division
same as right multiplication by divisor inverse
  left matrix division
same as left multiplication by divisor inverse
16
 Scalar functions –
used for scalars
and operate
element-wise when
applied to a matrix
or vector
 e.g. sin cos
tan atan
asin log abs
anglesqrt
roundfloor
17
 Vector functions –
operate on vectors
returning scalar
value
 e.g. max min
mean prod
sum length
18
 Matrix functions –
perform operations
on matrices
 e.g. eye size
inv det eig
 X = ones(r,c) %
Creates matrix full
with ones
19
 X = zeros(r,c) % Creates
matrix full with zeros
 A = diag(x) % Creates
squared matrix with vector
x in diagonal
 [r,c] = size(A) % Return
dimensions of matrix A
 B = rand(r,c) %creates a
matrix of random numbers.
20
 + - * / % Standard operations
 .+ .- .* ./ % Wise addition, subtraction,…
 v = sum(A) % Vector with sum of columns
21
22
23
 Note that
It is better to
multiply
A*inv(B)
instead of
divide A/B
24
25
Command flipud flips the matrix in UP/DOWN direction.
Command fliplr flips the matrix in LEFT/RIGHT direction
26
Some powerful matrix functions in Matlab
 X = A’ % Transposed matrix
(A transpose operation changes the column of a matrix into rows, and
rows into columns)
 X = inv(A) % Inverse matrix squared matrix
 X = pinv(A) % Pseudo inverse
 X = chol(A) % Cholesky decomp.
 d = det(A) % Determinant
 [X,D] = eig(A) % Eigenvalues and eigenvectors
 [Q,R] = qr(X) % QR decomposition
 [U,D,V] = svd(A) % singular value decomp
27
 maxVal =
max(aaa)
% finds the
maximum
value for a
matrix.
28
 minVal =
min(aaa);
% finds the
minimum
value for a
matrix.
29
 colSum =
sum(aaa);
% finds the
sum of each
column
30
 If A is a matrix,
sum(A) treats the
columns of A as
vectors, returning
a row vector of
the sums of each
column.
 B = sum(A,dim)
sums along the
dimension of A
specified by
scalar dim.
31
 B = sort(A,’ascend/descend’) % sorts a matrix. Default is
ascending mode.
32
1. A is a row vector. The first element in A is 0, and the
value vary from 0 to 10 with increment of 2
2. B is row vector with six elements, and every variable
in B is 2.5
3. Calculate the value of C, which is equal to the sum of
A and B
4. Calculate the value of D, which is equal to the
element-by element multiplication between A and B
5. Change A(1,3) to 8.
6. Calculate E = A./B
33
1. A=[1, 2.7, 8.9, -8, 4, 3.5]
2. B>0;
3. Return the sum and mean value of all the
elements in A.
4. Return the max value of all elements in A.
5. fix(A)
34
1. A=[1, 2.7, 8.9, -8, 4, 3.5; 6.5, 8.9, 5, -0.9,
3, 19] ;
2. Set every element in six column to be 0.7.
3. Remove the second column in A;
4. Return the mean value of every column in
A;
5. Return the mean value of whole A;
35
Ad

More Related Content

What's hot (20)

Matlab lec1
Matlab lec1Matlab lec1
Matlab lec1
Amba Research
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
Damian T. Gordon
 
2D Plot Matlab
2D Plot Matlab2D Plot Matlab
2D Plot Matlab
Jorge Jasso
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
Infinity Tech Solutions
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
ZunAib Ali
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Khulna University
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
Naveed Rehman
 
Basics of MATLAB programming
Basics of MATLAB programmingBasics of MATLAB programming
Basics of MATLAB programming
Ranjan Pal
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
Cheng-An Yang
 
A complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projectsA complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projects
Mukesh Kumar
 
What is matlab
What is matlabWhat is matlab
What is matlab
Shah Rukh Qureshi
 
Matlab1
Matlab1Matlab1
Matlab1
guest8ba004
 
Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
Mohd Esa
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
avinashkumer
 
Writing Fast MATLAB Code
Writing Fast MATLAB CodeWriting Fast MATLAB Code
Writing Fast MATLAB Code
Jia-Bin Huang
 
Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
THEMASTERBLASTERSVID
 
Mbd2
Mbd2Mbd2
Mbd2
Mahmoud Hussein
 
Matlab intro
Matlab introMatlab intro
Matlab intro
THEMASTERBLASTERSVID
 
Matlab Overviiew
Matlab OverviiewMatlab Overviiew
Matlab Overviiew
Nazim Naeem
 

Viewers also liked (11)

face recognition system using LBP
face recognition system using LBPface recognition system using LBP
face recognition system using LBP
Marwan H. Noman
 
Hand Written Character Recognition Using Neural Networks
Hand Written Character Recognition Using Neural Networks Hand Written Character Recognition Using Neural Networks
Hand Written Character Recognition Using Neural Networks
Chiranjeevi Adi
 
Pattern recognition on human vision
Pattern recognition on human visionPattern recognition on human vision
Pattern recognition on human vision
Giacomo Veneri
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Santosh V
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Mohan Raj
 
Final Year IEEE Project 2013-2014 - Digital Image Processing Project Title a...
Final Year IEEE Project 2013-2014  - Digital Image Processing Project Title a...Final Year IEEE Project 2013-2014  - Digital Image Processing Project Title a...
Final Year IEEE Project 2013-2014 - Digital Image Processing Project Title a...
elysiumtechnologies
 
Introduction to matlab_application_to_electrical_engineering
Introduction to matlab_application_to_electrical_engineeringIntroduction to matlab_application_to_electrical_engineering
Introduction to matlab_application_to_electrical_engineering
zulfikar37
 
Simulink - Introduction with Practical Example
Simulink - Introduction with Practical ExampleSimulink - Introduction with Practical Example
Simulink - Introduction with Practical Example
Kamran Gillani
 
Local binary pattern
Local binary patternLocal binary pattern
Local binary pattern
International Islamic University
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
ideas2ignite
 
face recognition system using LBP
face recognition system using LBPface recognition system using LBP
face recognition system using LBP
Marwan H. Noman
 
Hand Written Character Recognition Using Neural Networks
Hand Written Character Recognition Using Neural Networks Hand Written Character Recognition Using Neural Networks
Hand Written Character Recognition Using Neural Networks
Chiranjeevi Adi
 
Pattern recognition on human vision
Pattern recognition on human visionPattern recognition on human vision
Pattern recognition on human vision
Giacomo Veneri
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Santosh V
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Mohan Raj
 
Final Year IEEE Project 2013-2014 - Digital Image Processing Project Title a...
Final Year IEEE Project 2013-2014  - Digital Image Processing Project Title a...Final Year IEEE Project 2013-2014  - Digital Image Processing Project Title a...
Final Year IEEE Project 2013-2014 - Digital Image Processing Project Title a...
elysiumtechnologies
 
Introduction to matlab_application_to_electrical_engineering
Introduction to matlab_application_to_electrical_engineeringIntroduction to matlab_application_to_electrical_engineering
Introduction to matlab_application_to_electrical_engineering
zulfikar37
 
Simulink - Introduction with Practical Example
Simulink - Introduction with Practical ExampleSimulink - Introduction with Practical Example
Simulink - Introduction with Practical Example
Kamran Gillani
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
ideas2ignite
 
Ad

Similar to Introduction to matlab lecture 2 of 4 (20)

Basic concepts in_matlab
Basic concepts in_matlabBasic concepts in_matlab
Basic concepts in_matlab
Mohammad Alauddin
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Vikash Jakhar
 
1. Introduction to Computing - MATLAB.pptx
1. Introduction to Computing -  MATLAB.pptx1. Introduction to Computing -  MATLAB.pptx
1. Introduction to Computing - MATLAB.pptx
tgkfkj9n2k
 
Matlab
MatlabMatlab
Matlab
Sri Chakra Kumar
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and MatricesMATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
Shameer Ahmed Koya
 
bobok
bobokbobok
bobok
Adi Pandarangga
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
joellivz
 
Matlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics dsMatlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics ds
ragupathi90
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
Matlab an Introduction_Lecture_for all.ppt
Matlab an Introduction_Lecture_for all.pptMatlab an Introduction_Lecture_for all.ppt
Matlab an Introduction_Lecture_for all.ppt
PoojaSharma693700
 
Determinants, crammers law, Inverse by adjoint and the applications
Determinants, crammers law,  Inverse by adjoint and the applicationsDeterminants, crammers law,  Inverse by adjoint and the applications
Determinants, crammers law, Inverse by adjoint and the applications
NikoBellic28
 
Basics of Matlab for students and faculty
Basics of Matlab for students and facultyBasics of Matlab for students and faculty
Basics of Matlab for students and faculty
AbhishekRanjan17318
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
raghav415187
 
Matlab Tutorial
Matlab TutorialMatlab Tutorial
Matlab Tutorial
Ahmad Siddiq
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
Anil Maurya
 
Matlab ch1 (3)
Matlab ch1 (3)Matlab ch1 (3)
Matlab ch1 (3)
mohsinggg
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
imman gwu
 
Mat lab
Mat labMat lab
Mat lab
Gizachew Kefelew
 
matrix algebra
matrix algebramatrix algebra
matrix algebra
kganu
 
R Programming Intro
R Programming IntroR Programming Intro
R Programming Intro
062MayankSinghal
 
1. Introduction to Computing - MATLAB.pptx
1. Introduction to Computing -  MATLAB.pptx1. Introduction to Computing -  MATLAB.pptx
1. Introduction to Computing - MATLAB.pptx
tgkfkj9n2k
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
joellivz
 
Matlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics dsMatlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics ds
ragupathi90
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
Matlab an Introduction_Lecture_for all.ppt
Matlab an Introduction_Lecture_for all.pptMatlab an Introduction_Lecture_for all.ppt
Matlab an Introduction_Lecture_for all.ppt
PoojaSharma693700
 
Determinants, crammers law, Inverse by adjoint and the applications
Determinants, crammers law,  Inverse by adjoint and the applicationsDeterminants, crammers law,  Inverse by adjoint and the applications
Determinants, crammers law, Inverse by adjoint and the applications
NikoBellic28
 
Basics of Matlab for students and faculty
Basics of Matlab for students and facultyBasics of Matlab for students and faculty
Basics of Matlab for students and faculty
AbhishekRanjan17318
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
Anil Maurya
 
Matlab ch1 (3)
Matlab ch1 (3)Matlab ch1 (3)
Matlab ch1 (3)
mohsinggg
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
imman gwu
 
matrix algebra
matrix algebramatrix algebra
matrix algebra
kganu
 
Ad

More from Randa Elanwar (20)

الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
Randa Elanwar
 
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونينتعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)
Randa Elanwar
 
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
Randa Elanwar
 
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونينتعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7
Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)
Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)
Randa Elanwar
 

Recently uploaded (20)

Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 

Introduction to matlab lecture 2 of 4

  • 2. 1. >> for = 5 ??? for = 5 Error: The expression to the left of the equals sign is not a valid target for an assignment 2. >> else =6 ??? else = 6 Error: Illegal use of reserved keyword "else" 3. >> cos = 2; cos(0) ??? Subscript indices must either be real positive integers or logicals 4. >> A = [1,2,3]; sum(A) ans = 6 >> sum = 7; sum(A) ??? Index exceeds matrix dimensions 2
  • 3. 5. >> 5>2 ans = 1 6. >> 5<4 ans = 0 7. >> 1.5<=1.5 ans = 1 8. >> 2>=pi ans = 0 9. >> 1.8==1.801 ans = 0 10. >> 1.8~=2 ans = 1 11. >> 1.8==1.80000000000000000000000001 ans = 1 3
  • 4.  Creating and manipulating matrices  Built-in functions for matrices 4
  • 5.  Matlab treats all variables as matrices.  Vectors are special forms of matrices and contain only one row OR one column (A row vector is a 1xn matrix, A column vector is an mx1 matrix).  Scalars are matrices with only one row AND one column (A scalar is a 1x1 matrix)  Every matrix element has a numerical value. Non-digit elements linked to ASCII code digits A → 65, B → 66, etc. a → 97, b → 98, etc. - → 45, _ → 95, etc.  Logical truth values assigned to digits (true → 1, false → 0) 5
  • 6.  A matrix with only one row is called a row vector.  A row vector can be created in Matlab as follows (note the commas or you can use spaces): » rowvec = [12 , 14 , 63] rowvec = 12 14 63 6
  • 7.  A matrix with only one column is called a column vector.  A column vector can be created in MATLAB as follows (note the semicolons): » colvec = [13 ; 45 ; -2] colvec = 13 45 -2 7
  • 8.  A matrix can be created in Matlab as follows  (note the commas AND semicolons):  » matrix = [1 , 2 , 3 ; 4 , 5 ,6 ; 7 , 8 , 9] matrix = 1 2 3 4 5 6 7 8 9 8
  • 9.  A portion of a matrix can be extracted and stored in a smaller matrix by specifying the names of both matrices and the rows and columns to extract.  The syntax is: sub_matrix = matrix ( r1 : r2 , c1 : c2 ) ; where r1 and r2 specify the beginning and ending rows and c1 and c2 specify the beginning and ending columns to be extracted to make the new matrix. 9
  • 10. 10
  • 12.  The matrix indices begin from 1 (not 0 (as in C))  The matrix indices must be positive integer 12
  • 13.  Accessing Single Elements of a Matrix A(i,j)  Accessing Multiple Elements of a Matrix A(1,4) + A(2,4) + A(3,4) + A(4,4) A([1,3,4], :)= all of rows 1, 3 and 4 sum(A(1:4,4)) sum(A(:,end)) The keyword end refers to the last row or column.  Deleting Rows and Columns: to delete the second column of X, use X(:,2) = []  Concatenating Matrices A and B C=[A;B] 13
  • 14. 14
  • 15. Logic--searching with find  Find--searches for the truth (or not false) › b=[1 0 -1 0 0]; › I=find(b) I=1 3 b(I) is an array without zeros › I=find(ones(3,1)*[ 1 2 3]==2) I= 4 5 6 › [I,J]=find(ones(3,1)*[ 1 2 3]==2) I= 1 2 3 J= 2 2 2 15
  • 16.  + addition  - subtraction  * multiplication  ^ power  ‘ complex conjugate transpose  / right matrix division same as right multiplication by divisor inverse  left matrix division same as left multiplication by divisor inverse 16
  • 17.  Scalar functions – used for scalars and operate element-wise when applied to a matrix or vector  e.g. sin cos tan atan asin log abs anglesqrt roundfloor 17
  • 18.  Vector functions – operate on vectors returning scalar value  e.g. max min mean prod sum length 18
  • 19.  Matrix functions – perform operations on matrices  e.g. eye size inv det eig  X = ones(r,c) % Creates matrix full with ones 19
  • 20.  X = zeros(r,c) % Creates matrix full with zeros  A = diag(x) % Creates squared matrix with vector x in diagonal  [r,c] = size(A) % Return dimensions of matrix A  B = rand(r,c) %creates a matrix of random numbers. 20
  • 21.  + - * / % Standard operations  .+ .- .* ./ % Wise addition, subtraction,…  v = sum(A) % Vector with sum of columns 21
  • 22. 22
  • 23. 23
  • 24.  Note that It is better to multiply A*inv(B) instead of divide A/B 24
  • 25. 25 Command flipud flips the matrix in UP/DOWN direction. Command fliplr flips the matrix in LEFT/RIGHT direction
  • 26. 26
  • 27. Some powerful matrix functions in Matlab  X = A’ % Transposed matrix (A transpose operation changes the column of a matrix into rows, and rows into columns)  X = inv(A) % Inverse matrix squared matrix  X = pinv(A) % Pseudo inverse  X = chol(A) % Cholesky decomp.  d = det(A) % Determinant  [X,D] = eig(A) % Eigenvalues and eigenvectors  [Q,R] = qr(X) % QR decomposition  [U,D,V] = svd(A) % singular value decomp 27
  • 28.  maxVal = max(aaa) % finds the maximum value for a matrix. 28
  • 29.  minVal = min(aaa); % finds the minimum value for a matrix. 29
  • 30.  colSum = sum(aaa); % finds the sum of each column 30
  • 31.  If A is a matrix, sum(A) treats the columns of A as vectors, returning a row vector of the sums of each column.  B = sum(A,dim) sums along the dimension of A specified by scalar dim. 31
  • 32.  B = sort(A,’ascend/descend’) % sorts a matrix. Default is ascending mode. 32
  • 33. 1. A is a row vector. The first element in A is 0, and the value vary from 0 to 10 with increment of 2 2. B is row vector with six elements, and every variable in B is 2.5 3. Calculate the value of C, which is equal to the sum of A and B 4. Calculate the value of D, which is equal to the element-by element multiplication between A and B 5. Change A(1,3) to 8. 6. Calculate E = A./B 33
  • 34. 1. A=[1, 2.7, 8.9, -8, 4, 3.5] 2. B>0; 3. Return the sum and mean value of all the elements in A. 4. Return the max value of all elements in A. 5. fix(A) 34
  • 35. 1. A=[1, 2.7, 8.9, -8, 4, 3.5; 6.5, 8.9, 5, -0.9, 3, 19] ; 2. Set every element in six column to be 0.7. 3. Remove the second column in A; 4. Return the mean value of every column in A; 5. Return the mean value of whole A; 35
  翻译: