matrix dimensions% determines that LU decomposition; n-=. 4 % A = zeros (n-, n-); L = Eye (n-, n-); P = Eye (n-, n-); the U-= zeros (n-, n-); % initialization matrix tempU = zeros (1, n) ; tempP = zeros (1, n);% initialize the intermediate variables matrix A = [1 2 -3 4; 4 8 12 -8; 2 3 2 1; -3 -1 1-4];% LU decomposition requires the assignment matrix for p = 1: n% of the A matrix is assigned to the U- for Q =. 1: n- the U-(P, Q) = A (P, Q); End End JT =. 1; 0 = KT; for I =. 1:. 1-n- JT = JT +. 1; KT = KT +. 1; II the U-= (I, I); IF II == 0% PCA zero performs line change for m = I: n- IF the U-(m, I) = 0 ~ tempU the U-= (I, :); the U-(I,:) = the U-(m, :); the U-(m,:) = tempU; II the U-= (I , I); %% tempP = P (i, :); % conversion result is stored in the line P, P (I,:) = P (m, :); P (m,:) = tempp; BREAK; End End % DISP (II); End DISP (II); for J = JT: n-%% double loop, complete Gaussian elimination perj the U-= (J, I) / II; L (J, I) = perj; for K = KT: n- the U-( J, K) = the U-(J, K) the U--perj * (I, K); End End End saveFile = 'LUdapart'; Save (saveFile)