matrix operation (ii)

21
1 Matrix Operation (II) ผผ.ผผ.ผผผผผผ ผผผผผผผ Anan Phonphoem http://www.cpe.ku.ac.th/ ~anan [email protected]

Upload: thisbe

Post on 21-Jan-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Matrix Operation (II). ผศ.ดร.อนันต์ ผลเพิ่ม Anan Phonphoem http://www.cpe.ku.ac.th/~anan [email protected]. Arithmetic Operation. Element-by-Element Matrix Operation. a 1 a 3 a 2 a 4. 2 1 0. b 1 b 3 b 2 b 4. A=. B=. A=. B=. 3 4 -1 5. 30 8 -1 0. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Matrix Operation (II)

1

Matrix Operation (II)

ผศ.ดร.อนั�นัต์ ผลเพิ่��มAnan Phonphoem

http://www.cpe.ku.ac.th/[email protected]

Page 2: Matrix Operation (II)

2

Arithmetic Operation

Element-by-Element Matrix Operation

Page 3: Matrix Operation (II)

3

Element-by-Element

10 2 1 0

3 4-1 5

A= B=

C= A.*B =

=30 8-1 0

(10)(3) (2)(4)(1)(-1) (0)(5)

a1 a3

a2 a4 A= B=b1 b3

b2 b4

C = A.*B

(a1)(b1) (a3)(b3)(a2)(b2) (a4)(b4)

=

Page 4: Matrix Operation (II)

4

Matrix Operation

a1 a3

a2 a4 A= B=b1 b3

b2 b4

C = A*B (a1)(b1)+(a3)(b2) (a1)(b3)+(a3)(b4) (a2)(b1)+(a4)(b2) (a2)(b3)+(a4)(b4)

=

10 21 0 A= B=3 4

-1 5

C = A*B (10)(3)+(2)(-1) (10)(4)+(2)(5) (1)(3)+(0)(-1) (1)(4)+(0)(5)

= =28 503 4

Page 5: Matrix Operation (II)

5

Matrix Multiplication (I)

x xx x

y y

X = Y =

X * Y =

2 x 2 2 x 1

x xx x

y y 2 x 1

z z

Page 6: Matrix Operation (II)

6

Matrix Multiplication (II)

x xx xx x

y y

X = Y =

X * Y =

3 x 2 2 x 1 3 x 1

y y

x xx xx x

z zz

Page 7: Matrix Operation (II)

7

Matrix Multiplication (III)

X * Y =

1 x 3 3 x 2 1 x 2

x x xX = Y =y yy yy y

z z

x x xy yy yy y

Page 8: Matrix Operation (II)

8

Matrix Multiplication (IV)

X * Y =

2 x 2 2 x 3 2 x 3

z z z z z z

X = Y =x xx x

y y yy y y

x xx x

y y yy y y

Page 9: Matrix Operation (II)

9

Matrix Multiplication (V)

X * Y =

3 x 1 1 x 3 3 x 3

y y yX = Y =xxx

z z z z z zz z z

xxx

y y y

Page 10: Matrix Operation (II)

10

Matrix Multiplication (VI)

X * Y =

1 x 3 3 x 1 1 x 1

z

x x xX = Y =yyy

x x xyyy

Page 11: Matrix Operation (II)

11

Matrix Multiplication (VII)

x xx xx x

y yX = Y =

X * Y =

3 x 2 1 x 2

x xx xx x

y y Error Message

Page 12: Matrix Operation (II)

12

Matrix Multiplication (VIII)

X * Y =

1 x 3 1 x 3

Error Message

y y yX = Y =x x x

x x x y y y

X .* Y = z z z

Page 13: Matrix Operation (II)

13

Special Matrix

Command Description

eye(n) Identity Matrix

eye(size(A) Identity Matrix

ones(n) All “1” Matrix

zeros(n) All “0” Matrix

zeros(m,n) All “0” Matrix (mxn)

Page 14: Matrix Operation (II)

14

Special Matrix1 0 0 0 1 00 0 1

eye(3) =

1 1 1 1 1 11 1 1

ones(3) =

0 0 0 0

zeros(2) =

zeros(1,3) = 0 0 0

Page 15: Matrix Operation (II)

15

Special Matrix

0 A = A 0 = 0

I A = A I = A

1 0 0 0 1 00 0 1

I = 0 0 0 0 0 00 0 0

Zero Matrix

Page 16: Matrix Operation (II)

16

Polynomial

Example:

f(x) = a1xn + a2xn-1 + a3xn-2 + …+ anx + an+1

Degree = Order =

n

y = 3x2 + 4 Order = 2

y = 12x3 + 2x2 + 1 Order = 3

Page 17: Matrix Operation (II)

17

Polynomial Coefficient

f(x) = a1xn + a2xn-1 + a3xn-2 + …+ anx + an+1

[ a1 a2 a3 … an-1 an an+1 ]

y = 12x3 + 2x2 + 1

[ 12 2 0 1 ]

Page 18: Matrix Operation (II)

18

Polynomial Coefficient

[ 5 6 3 0 2 ]

[ 4 -6 0 0 ]

[ 1 1 1 1 ]

y = 5x4 + 6x3 + 3x2 + 2

b = 4a3 – 6a2

T = x3 + x2 + x + 1

Page 19: Matrix Operation (II)

19

Roots of polynomial

y = x2 – 3x + 2

= (x – 1) (x – 2)

Roots of y 1 , 2

a = [ 1 -3 2]

c = roots(a)

= [ 1 2 ]

T = roots( [ 1 -3 2 ] )

Page 20: Matrix Operation (II)

20

Polynomial of roots

Roots of y = 1 , 2

y = x2 – 3x + 2

(x – 1) (x – 2)

r = [ 1 2 ]

>>poly(r)ans = 1 -3 2

P = poly([ 1 2 ])

Page 21: Matrix Operation (II)

21

Poly ( ) roots ( )

y = x2 – 3x + 2 roots ( [1 –3 2 ] ) [ 1 2 ]

[ 1 –3 2 ] (x – 1)(x – 2)poly ( [1 2 ] )