For Ax=b, How do I make LU decomposition (A=L*U) without using lu function. For example, A is nxn matrix and bis nx1 matrix.
Show older comments
clc
clear
A=rand(5)
b=rand(5,1);
A(2:3,1)
n=length(A)
U=A;
for i=1:n
k=i+1
i
U(k:n,i)=U(k:n,i)-U(i,i)*(U(k:n,i)/U(i,i))
end
for k= 1:n
L(k+1:n,k)=A(k+1:n,k)/A(k,k)
end
This is what I have try so far, I am very new to MATLAB like 2 week and genuinely struggle here.
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Decomposition in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!