Modifying lutx function in matlab -
this first question. looking point me in right direction.
the matrix factorization lu = pa can used compute determinant of a. have
det(l)det(u) = det(p)det(a).
because l triangular ones on diagonal, det(l) = 1
. because u triangular, det(u) = u 11 u 22 · · · u nn
. because p permutation, det(p) = +1
if number of interchanges , −1 if odd. det(a) = ±u 11 u 22 · · · u nn
.
modify lutx function returns 4 outputs.
function [l,u,p,sig] = lutx(a) %lu triangular factorization % [l,u,p,sig] = lutx(a) computes unit lower triangular % matrix l, upper triangular matrix u, permutation % vector p, , scalar sig, l*u = a(p,:) , % sig = +1 or -1 if p or odd permutation.
write function mydet(a) uses modified lutx compute determinant of a. in matlab, product u 11 u 22 · · · u nn can computed look prod(diag(u)).
i having problem getting function display 4 outputs. not understand why function not automatically. if point me in right direction, appreciated.
matlab
No comments:
Post a Comment