Professional Documents
Culture Documents
DownloadClassSessionFile - 2024-02-26T205046.953
DownloadClassSessionFile - 2024-02-26T205046.953
College of Engineering
Software and Informatics Engineering Department
Second Year Class
Numerical Analysis
and
Probability
Matrix Continue
Lecturer
Kanar Shukr Muhamad
2023-2024
• 28th Feb 2024 Practical Exam: Mark on %10
2
Matrix
❖r=roots(polynomialMatrix)
a matrix]
❖ p=poly(r)
❖ x=polyval(p,value)
3
Matrix
The single quate(‘) transpose the given matrix
4
Matrix
Matrix Addition or subtraction: can be done using +
and -
a = [1 2 3;1 2 3];
b = [1 1 1;2 2 2];
5
Matrix
Access matrix elements:
d=a(i1,j1)+b(i2,j2)
val=a(1,2)+b(1,2)
6
Matrix
Matrix Multiplication using *
>>a=[1 1 1 ; 1 1 1]
>> b=[1 2; 1 2;1 2]
>> c=a*b
% c=
3 6
7
3 6
Scalar - Matrix Operations
» a=3;
» b=[1 2 3; 1 2 3];
b=
1 2 3
4 5 6
»c=a*b % Multiply each element of matrix b by a
c=
3 6 9
3 6 9
>>a+b %????
>>a-b %????
>>a/b %????
Matrix
Element-by-element multiplication of two matrices,
dimensions must agree.
a = [1 3; 2 4];
b = [0 5; 10 2];
c = a.*b
% c=
0 15
20 8
9
Activities
Q1/ Create a 3 by 3 matrix. Fill it with random values from 0 to 9,
Like:
Array=MF()
10 Array = [ 1 2 3 3 4 4 5]