Advertisement
DMG

Donja trougaona matrica

DMG
Oct 27th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.32 KB | None | 0 0
  1. function A = donja_trougaona(A)
  2.     [rows, cols] = size(A);
  3.    
  4.     if (rows~=cols)
  5.         return;
  6.     end
  7.    
  8.     for k = rows:-1:2
  9.        for i = k-1:-1:1
  10.           coefficient = (-1)*A(i,k)/A(k,k);
  11.           for j = 1:k
  12.               A(i, j) = A(i, j) + coefficient*A(k,j);
  13.           end
  14.        end
  15.     end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement