【正文】
MATLAB 程式設計:進階篇 線性代數(shù) 張智星 (Roger Jang) 臺大資工系 多媒體檢索實驗室 MATLAB 程式設計進階篇:線性代數(shù) 反矩陣 ? 反矩陣 : ? 一個矩陣 A 的反矩陣可表示成 ,滿足下列恆等式: ? 只有在 A 為方陣時, 才存在。 ? 若 不存在,則 A 稱為 Singular IAAIAA????111?A1?A1?AQuiz! MATLAB 程式設計進階篇:線性代數(shù) 反矩陣 (2) ? inv: ? MATLAB 的 inv 指令可用於計算反矩陣 ? 範例 61: ? 結果 : B = ? Note that det(pascal(n)) is always equal to 1. A = pascal(4)。 % 產生 4x4 的 Pascal 方陣 B = inv(A) MATLAB 程式設計進階篇:線性代數(shù) 反矩陣 (3) ? inv: ? 若矩陣 A 為 Singular (即其反矩陣不存在),則在使用 inv 指令時,會產生警告訊息 ? 範例 62: ? 結果 : A = [1 2 3。 4 5 6。 7 8 9]。 B = inv(A) W a r n i n g : M a t r i x i s c l o s e t o s i n g u l a r o r b a d l y s c a l e d . Re s u l t s m a y b e i n a c c u r a t e . RC O N D = 1 . 5 4 1 9 7 6 e 018. In inv02 at 2 B = 1 . 0 e + 0 1 6 * 0 . 4 5 0 4 0 . 9 0 0 7 0 . 4 5 0 4 0 . 9 0 0 7 1 . 8 0 1 4 0 . 9 0 0 7 0 . 4 5 0 4 0 . 9 0 0 7 0 . 4 5 0 4 MATLAB 程式設計進階篇:線性代數(shù) 行列式 ? det: ? 欲計算矩陣 A 的行列式,可用 det 指令 ? 範例 63: ? 結果 : d = 29 A = [1 3 4。 3 4 1。 2 2 5]。 d = det(A) MATLAB 程式設計進階篇:線性代數(shù) 反矩陣 公式 ? 由 Crammer Rule 可知矩陣 A 的行列式和反矩陣有下列關係式 : ? 其中 代表 A 的行列式, 代表 A 的 Adjoint Matrix ? Equivalent statements ? is singular ? does not exist ? IAAadjAA AadjA *)(*)(1 ????A )(AadjA1?A0?AQuiz! Quiz! MATLAB 程式設計進階篇:線性代數(shù) Cofactor and Adjoint ? Take a 3x3 matrix A for example: ? ?IAAadjAAc o f a c t o rAadjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAAAAAAAAAAc o f a c t o raaaaaaaaaAT*)(*)()(222112112321131123221312323112113331131133321312323122213331232133322322333231232221131211333231232221131211??????????????????????????????????????????????????. ..131312121111 ???? AaAaAaAQuiz! MATLAB 程式設計進階篇:線性代數(shù) How to Verify the Formula? IAAAAAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAAAAAAAAAaaa