Attachment 'Aufgabe2.m'

Download

   1 function d = Aufgabe2(A, k)
   2 %Aufgabe2 - compute determinant of a matrix by recursion over its minors.
   3 %
   4 %usage
   5 %  d = Aufgabe2(A, k)
   6 %
   7 %input
   8 %  A : (n,n)-matrix.
   9 %  k : Row index in A.
  10 %
  11 %output
  12 %  d : Determinant of A.
  13 %
  14 %description
  15 %  Aufgabe2 computes the determinant of A by summing over the determinants of its
  16 %  minors in row k. The determinants of the minors are computed by recursion where 
  17 %  the trivial case is a (1,1)-matrix.
  18 %
  19 %author
  20 %  buenau@cs.tu-berlin.de
  21 
  22 [n,m] = size(A);
  23 if n ~= m, error('Matrix ist nicht quadratisch'); end
  24 
  25 if n == 1  
  26     % Trivial case.
  27     d = A(1,1);
  28 else
  29     d = 0;
  30     % Sum over minors in row k. 
  31     for j = 1:n
  32       d = d + ((-1).^(k+j) )*A(k,j) * Aufgabe2(A([1:(k-1) (k+1):n], [1:(j-1) (j+1):n]), k-1);
  33     end
  34 end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-03-12 14:03:20, 1.5 KB) [[attachment:Aufgabe1.m]]
  • [get | view] (2009-03-12 14:03:20, 0.8 KB) [[attachment:Aufgabe2.m]]
  • [get | view] (2009-03-12 14:03:20, 1.0 KB) [[attachment:Aufgabe3.m]]
  • [get | view] (2009-03-12 14:03:20, 1.2 KB) [[attachment:Aufgabe4.m]]
  • [get | view] (2009-03-12 14:03:20, 1.5 KB) [[attachment:Aufgabe5.m]]
  • [get | view] (2009-03-12 14:03:20, 88.7 KB) [[attachment:ML_Praktikum_U01.pdf]]
  • [get | view] (2009-03-12 14:03:20, 89.4 KB) [[attachment:ML_Praktikum_U02.pdf]]
  • [get | view] (2009-03-12 14:03:20, 78.5 KB) [[attachment:ML_Praktikum_U03.pdf]]
  • [get | view] (2009-03-12 14:03:20, 96.2 KB) [[attachment:ML_Praktikum_U04.pdf]]
  • [get | view] (2009-03-12 14:03:20, 74.4 KB) [[attachment:ML_Praktikum_U05.pdf]]
  • [get | view] (2009-03-12 14:03:20, 86.7 KB) [[attachment:ML_Praktikum_U06.pdf]]
  • [get | view] (2009-03-12 14:03:20, 80.0 KB) [[attachment:Matlab_diary.txt]]
  • [get | view] (2009-03-12 14:03:20, 6.3 KB) [[attachment:U03_2gaussians.dat]]
  • [get | view] (2009-03-12 14:03:20, 15.6 KB) [[attachment:U03_5gaussians.dat]]
  • [get | view] (2009-03-12 14:03:20, 1020.4 KB) [[attachment:U04_datasets.zip]]
  • [get | view] (2009-03-12 14:03:20, 6.4 KB) [[attachment:U05_datasets.zip]]
  • [get | view] (2009-03-12 14:03:20, 60.1 KB) [[attachment:fishbowl.mat]]
  • [get | view] (2009-03-12 14:03:20, 22.7 KB) [[attachment:flatroll.mat]]
  • [get | view] (2009-03-12 14:03:20, 22.7 KB) [[attachment:flattroll.mat]]
  • [get | view] (2009-03-12 14:03:20, 343.4 KB) [[attachment:guide.pdf]]
  • [get | view] (2009-03-12 14:03:20, 32.8 KB) [[attachment:long_words.mat]]
  • [get | view] (2009-03-12 14:03:20, 7.6 KB) [[attachment:ratbert-debate.mat]]
  • [get | view] (2009-03-12 14:03:20, 45.3 KB) [[attachment:swissroll.mat]]
  • [get | view] (2009-03-12 14:03:20, 69.4 KB) [[attachment:tu_logo.mat]]
  • [get | view] (2009-03-12 14:03:20, 4053.5 KB) [[attachment:usps.mat]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.