math245lab11

math245lab11 - Math245 Computer Lab set #11, Spring 2008...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Math245 Computer Lab set #11, Spring 2008 Matrix computation by using Matlab Matlab is a excellent tool for matrix related computations. Here is just a little example to compute the determinant, inverse matrix, solution to the linear system and eigenvalue/eigenvectors. Example Consider a linear system Ax = b with A = 1 0 0 2 1 - 2 3 2 1 and b = 2 - 3 12 . Define matrix A and right hand side of equation b A=[1 0 0; 2 1 -2; 3 2 1] A = 1 0 0 2 1 -2 3 2 1 b =[2 -3 12]’ b = 2 -3 12 Compute determinant of A det(A) ans = 5 Compute inverse matrix A - 1 inv(A) ans = 1.0000 0 0 -1.6000 0.2000 0.4000 0.2000 -0.4000 0.2000 Check if this is really a inverse of A (A - 1 A should be identity I) inv(A)*A ans = 1 0 0 0 1 0 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
0 0 1 Solve a linear system Ax = b A\b ans = 2.0000 1.0000 4.0000 So the solution x = 2 . 0 1 . 0 4 . 0 . The backslash symbol ‘ \ ’ is called left division operator. Compute eigenvalue of A
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/08/2009 for the course MATH 245 at USC.

Page1 / 3

math245lab11 - Math245 Computer Lab set #11, Spring 2008...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online